Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
AlexWest
Creator
Creator

Load excel with different file names and sheet names

Hi guys! 

Please help with the following issue:

I have 2 excel files:

File1, sheet1; 

File2, sheet2. 

Structure of headers the same.

What script I have to write to load both files in one block? 

Of course, I can load files one by one in 2 loads and concatenate them, but it is not right)) so I thought, maybe there's some way that can load 2 files in 1 load? 

Thank you!

Labels (1)
1 Solution

Accepted Solutions
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Alex,

You can load multiple files using a wildcard, like this:

load * from file*.xslx 

However, the worksheet names would have to be identical. If the worksheet names are different, then you'd have to load these files separately and specify each worksheet name accordingly.

If you have any (unknown) number of Excel files and any (unknown) number of worksheets inside of these files, you'd have to run a loop (cycle) that goes through all existing files in a given folder, then open each file with an Excel ODBC driver (it should exist, look it up), and then load all existing worksheets using the SQLTABLES command. Then, you could run another loop and load all these tables one by one. This is a bit complicated, but it would allow you a full flexibility to load the data, no matter how many files and worksheets you might have.

 

Cheers,

View solution in original post

2 Replies
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Alex,

You can load multiple files using a wildcard, like this:

load * from file*.xslx 

However, the worksheet names would have to be identical. If the worksheet names are different, then you'd have to load these files separately and specify each worksheet name accordingly.

If you have any (unknown) number of Excel files and any (unknown) number of worksheets inside of these files, you'd have to run a loop (cycle) that goes through all existing files in a given folder, then open each file with an Excel ODBC driver (it should exist, look it up), and then load all existing worksheets using the SQLTABLES command. Then, you could run another loop and load all these tables one by one. This is a bit complicated, but it would allow you a full flexibility to load the data, no matter how many files and worksheets you might have.

 

Cheers,

AlexWest
Creator
Creator
Author

Thanks for answer! 🙂