Hello, dear statalist community!
I am trying to import csv files and save them to xlsx format, but I must keep the same sheet names in the new xlsx files from the original csv files
I am having a lot of trouble finding the right code or command to extract the sheet name from a csv file
I have tried r(workseeht_1), but the command does not seem to work for csv files
my code is:
import delimited filename.csv, clear
local sheetname = `r(worksheet_1)'
export excel using filename.xlsx, sheet("`sheetname'", replace)
Anyone has an idea of what could work to incorporate the extraction of the sheet name from the cvs file into my code?
Thanks in advance for your help!!
Kind regards,
Antonio
I am trying to import csv files and save them to xlsx format, but I must keep the same sheet names in the new xlsx files from the original csv files
I am having a lot of trouble finding the right code or command to extract the sheet name from a csv file
I have tried r(workseeht_1), but the command does not seem to work for csv files
my code is:
import delimited filename.csv, clear
local sheetname = `r(worksheet_1)'
export excel using filename.xlsx, sheet("`sheetname'", replace)
Anyone has an idea of what could work to incorporate the extraction of the sheet name from the cvs file into my code?
Thanks in advance for your help!!
Kind regards,
Antonio
Comment