Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
MindaugasBacius
Partner - Specialist III
Partner - Specialist III

Load excel data from different sheet

Hei,

I manage to load information from all excel files in folder by using this script:

SUB DoDir(Root) 

 

FOR each File in filelist( Root & '\*.xls') 

    LOAD @1,   

         @2 

    FROM 

    [$(File)] 

    (biff, no labels, table is Sheet1$); 

NEXT File 

 

FOR each Dir in Dirlist (Root&'\*') 

     CALL DoDir(Dir) 

NEXT Dir 

 

END SUB  

 

CALL DoDir('C:\Users\Mindaugasb\Desktop\Orders\2016') 

Now how should I change the script to load information from different sheets in the files?

Thank you!

1 Solution

Accepted Solutions
Gysbert_Wassenaar

4 Replies
Gysbert_Wassenaar

See this example: Re: Loading Multiple Excel Files and Multiple Excel sheets


talk is cheap, supply exceeds demand
Anonymous
Not applicable

Hi Gysbert,

How do I modify the code you provided in the link when I have no connection nor SQL installed? I tried using the same code and disabling the line about SQL. It loads all .xlsx files with the proper filename but the sheetname cannot be extracted. Thanks!

Gysbert_Wassenaar

You don't need to install an SQL database management system. But you do need the odbc driver for excel files. The sqltables command is passed to and execute by the odbc driver to get the list of sheetnames from the excel file.


talk is cheap, supply exceeds demand