Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
haymarketpaul
Contributor III

Concatenate Multiple csv Files with Filenames

Hi All

I have over 2000 csv files in a folder all with exactly the same structure and i need to concatenate them all together.

I am thinking i can do something like this as they will auto concatenate but I also need to store in a field the name of the file where each record came from and I am unsure how best to achieve that.  Any advice welcome.

For each File in FileList('$(vPath)\*.csv')

TableName:

Load

     Field1,

     Field2,

     FieldN

From $(File);

  

NEXT

Tags (2)
1 Solution

Accepted Solutions
rustyfishbones
Honored Contributor II

Re: Concatenate Multiple csv Files with Filenames

Hi Paul,

Select one file from the csv files

add this to your script to get the filename

FileName() as Filename

and to load all 2000 csv files place a * after the part of the filename most common with all 2000 csv's

Alan

8 Replies
Not applicable

Re: Concatenate Multiple csv Files with Filenames

rustyfishbones
Honored Contributor II

Re: Concatenate Multiple csv Files with Filenames

Hi Paul,

Select one file from the csv files

add this to your script to get the filename

FileName() as Filename

and to load all 2000 csv files place a * after the part of the filename most common with all 2000 csv's

Alan

rustyfishbones
Honored Contributor II

Re: Concatenate Multiple csv Files with Filenames

Also check a video by Steve Dark on youtube called

Qlikview - Loading Data from Multiple Files

haymarketpaul
Contributor III

Re: Concatenate Multiple csv Files with Filenames

That looks very useful, and may just do the trick - thanks

haymarketpaul
Contributor III

Re: Concatenate Multiple csv Files with Filenames

All filenames are completely different sadly

haymarketpaul
Contributor III

Re: Concatenate Multiple csv Files with Filenames

Thanks - i'll take a look at that

rustyfishbones
Honored Contributor II

Re: Concatenate Multiple csv Files with Filenames

If the names are completely different it's fine just say

myfolderstructure\*.csv

haymarketpaul
Contributor III

Re: Concatenate Multiple csv Files with Filenames

Perfect - Thank you - easier than i thought

Community Browser