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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

automatically load all Data from directory

Hi,

I have several CSV data in Directory for example C:\test\. The all Data have the same filed. In every month come the new date in this directory for actual month.

For example:

1) Date_1 (data from January)

2) Date_2 (data from February) and.....

How can I load automatically the all Data from Directory: C:\test\*.csv in QVW and concanate all together automatically in one table?

Thanks.

Labels (1)
1 Solution

Accepted Solutions
Not applicable
Author

Hey i use to do the same many times . Put as many as xls file in you folder it will come to your doc.

Use the Below in your edit script

SET MODELED_Folder="C:\Users\Administrator\Desktop\MY_Report";

for each file in filelist('$(MODELED_Folder)\*.xls')
load*
from $(file)(biff, embedded labels, table is Sheet1$);
next file

If req any help or query ... invited 🙂

Regards

Ashwin

View solution in original post

8 Replies
Miguel_Angel_Baeyens
Support
Support

Hello,

Something like the following should work

SET vDirectory = 'C:\QlikView\Data\'; Data: LOAD * FROM [$(vDirectory)*.qvd] (qvd);


or in case of csv

SET vDirectory = 'C:\QlikView\Data\'; Table:LOAD *FROM // enclosed in case there are some blanks in the path(txt, codepage is 1252, no labels, delimiter is '\t', msq);


If all files have the same number and name of fields, they will be concatenated implicitly with no need of loop or conversion.

Hope this helps

Not applicable
Author

Hi ,

the statemant you need will look like this:

LOAD

YourFields

FROM [Date_*.xls] (biff, embedded labels, table is Sheet1$);

Are field names the same QV automatically concatenate it.

Good luck!

Rainer

Not applicable
Author

Hey i use to do the same many times . Put as many as xls file in you folder it will come to your doc.

Use the Below in your edit script

SET MODELED_Folder="C:\Users\Administrator\Desktop\MY_Report";

for each file in filelist('$(MODELED_Folder)\*.xls')
load*
from $(file)(biff, embedded labels, table is Sheet1$);
next file

If req any help or query ... invited 🙂

Regards

Ashwin

Not applicable
Author

Hi,

Thanks, that works perfekty.

Regards

Not applicable
Author

Just wanted to thank you because this post has saved me a LOT of time.

Not applicable
Author

Hi Miguel

I read your reply with interest and have a similar problem. I have a lot of "identical" files that are snapshots taken on different days. For convenience they have been organised into folders by month i.e. I have a directory for a specific report with folders Jan, Feb, Mar etc. I know I can lift all the files from within one of these folders through a single load statement but is there a way to lift all those in the subfolders without having a separate load statement for each subfolder?

I'm just starting with QV and have a lot of files that are organised this way that I would potentially want to lift into QV.

Thanks

K

Miguel_Angel_Baeyens
Support
Support

Hello Kathryn,

As far as I know (have tested) LOAD in conjunction with "*" works with the current directory only, either one set manually, variable, using the "Directory;" statement or using the current one (when no directory is set).

So to loop in a given tree structure, you should use a loop function, creating variables so you get the next directory to be read, and once there, yes, using the "*" to load all files within it. There are many posts about this, this one, for example.

Hope that helps.

Not applicable
Author

Hi Miguel

Thank you, that was exactly what I was looking for. I had looked through the community site but didn't find that post - think I need to work on my searches Smile

with thanks

Kathryn