I would like to import multiple sheets of an excel file. I'm using a the current directory to select the files for import, so that I can use a fuzzy match with the file names. I see the correct file in the display of the filelist macro, here called "populationlinelist_healthstats 2024-09-15t19_13_04.111z.xlsx"
I'm receiving an error on the import step, r(106) file populationlinelist_healthstats 2024-09-15t19_13_04.111z.xlsx" not found
Any suggestions on improvement are appreciated.
I'm receiving an error on the import step, r(106) file populationlinelist_healthstats 2024-09-15t19_13_04.111z.xlsx" not found
Code:
*** 0.A.1 Folder Navigation
local fldr_pipeline "I:/EandE/5. Pipeline"
local fldr_refresh "I:/EandE/4. Refreshes"
local fldr_PEAR_HAPI "`fldr_refresh'/Human API (HAPI) Files/Imms_PEAR"
***************************************************************************************************
*** PART 1: Changing working directory and Load Population Line List
****************************************************************************************************
*** 0.a Change working directory
cd "`fldr_PEAR_HAPI'"
***0.b. Load HAPI Population Line List
dir *.xlsx
local filelist: dir "." files "PopulationLineList_HealthSTATS*.xlsx"
di `"`filelist'"'
*** 1.a Append each worksheet for Population Line List
forvalues i=1/3 {
tempfile population
save `population', emptyok
import excel `"`filelist'"', sheet("Page1_`i'") firstrow clear
append using `population'
}
save `"`population'"', replace

Comment