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

How to loop through Multiple csv files from folder and generate Qvd for each file

Hi Techies,

How to load multiple csv files in single load statement in Qlikview.

Problem is ::::

I have a some files in one location.. my point of view i want to load all files and generate qvd data file for each source file.

It should be done dynamically..

In SSIS, it is possible, Is there any possibility using Foreach loop and variables.

Thanks

Chandra Mohan

3 Replies
marcus_sommer

You could use a script like this or see the examples in help under "for ... next // for each ... next":

x:

Load *, filename() as FileName From Path\Prefix*.csv (txt, codepage is 1252, embedded labels, delimiter is '\t', no quotes)

let vFileCount = fieldvaluecount(FileName);

for i = 0 to $(vFileCount) - 1

let vFileName = peek('FileName', $(i), 'x');

temp:

noconcatenate Load * Resident x Where FileName = '$( vFileName)';

store temp into '$( vFileName)'.qvd (qvd);

drop table temp;

next

Which way will best suited is depend from your folder/filename-structure, amount of data ...

- Marcus

Not applicable
Author

Hi Marcus,

The Debugger skipping the Execution  and throwing an error at below code line.

Set vPath='C:\Users\chandra.mohanc\Desktop\QlikView Training\Sources\';

X:

Load *,
filename() as FileName
From $(vPath)*.csv
(txt, codepage is 1252, embedded labels, delimiter is '\t', no quotes);

marcus_sommer

Try this and/or check the path:

From [$(vPath)*.csv] ...