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

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
david_ze
Partner - Contributor III
Partner - Contributor III

Loading excel files from several directories

hi all,

Will appreciate your help and advice...

I'm loading all excel files located in directory 'c:\temp', using the below code:


Directory C:\temp\
set filectr=0;
For each ExcelFile in filelist ('*.xls')
If filectr=0 then
temp_xls_files:
Load Date1 as sign_date, 
cellnum,
cust_name
from $(ExcelFile) (biff, embedded labels, header is 1 lines, table is Sheet1$);
Else
temp_xls_files:
Concatenate
Load Date1 as sign_date, 
cellnum,
cust_name
from $(ExcelFile) (biff, embedded labels, header is 1 lines, table is Sheet1$);
EndIf
Let filectr=$(filectr)+1;
next ExcelFile

now, I would like to load more files (in the same format) but from additional directory - c:\temp1.
when I'm duplicating the code to load from c:\temp1, QV creats Synthetic keys for each field.

My question is, how can i use the above code to load all excel files from several directories ?

Thanks in advanced.
David

1 Solution

Accepted Solutions
Not applicable

Hello David,

I hope you are not using the if part for the second directory. Just concatenate is enough.

Regards,

Kiran.

View solution in original post

2 Replies
Not applicable

Hello David,

I hope you are not using the if part for the second directory. Just concatenate is enough.

Regards,

Kiran.

david_ze
Partner - Contributor III
Partner - Contributor III
Author

You're right...I've eliminated the if and it works ok.
Thanks Kiran for your advise,
David