Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Load data from lots of files

Hi everybody,

I am loading data from about 40 csv files, all of which have the same format and sit in the same folder. At the moment I am going through it 4 files at a time, specfying the file name and storing everything in a qvd as I go:


MyTable:
LOAD Field1,
Field2,
Field3
FROM D:\MyFolder\File1.csv;
CONCATENATE
LOAD Field1,
Field2,
Field3
FROM D:\MyFolder\File2.csv;
etc...
CONCATENATE
LOAD Field1,
Field2,
Field3
FROM D:\MyFolder\MyQVD.qvd (qvd);
STORE MyTable INTO D:\MyFolder\MyQVD.qvd;




After each run I edit the scipt to specify the file names of the next 4 csv files. Obviously, this is taking some time.

I'm wondering if there's a way to do something along these lines:


Set MyFolder = D:\MyFolder\
For Each csvFile in MyFolder
Set MyCSV = csvFile.Name
MyTable:
LOAD Field1,
Field2,
Field3
FROM D:\MyFolder\MyCSV ;
CONCATENATE
LOAD Field1,
Field2,
Field3
FROM D:\MyFolder\MyQVD.qvd (qvd);
STORE MyTable INTO D:\MyFolder\MyQVD.qvd;
Next


Does that make any sense?

Any suggestions gratefully received.

Tony

1 Solution

Accepted Solutions
hector
Specialist
Specialist

Hi, maybe you can try this Load

T1:
Load
Field1,
Field2,
Field3

FROM D:\MyFolder\File*.csv;

So, then you can do this (because the files are going to concatenate automatically)

Store T1 into T1.qvd;

is this helpful?

rgds

View solution in original post

2 Replies
hector
Specialist
Specialist

Hi, maybe you can try this Load

T1:
Load
Field1,
Field2,
Field3

FROM D:\MyFolder\File*.csv;

So, then you can do this (because the files are going to concatenate automatically)

Store T1 into T1.qvd;

is this helpful?

rgds

Not applicable
Author

Thanks Hector, that worked perfectly.

cheers,

Tony