Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
haymarketpaul
Creator III
Creator 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

1 Solution

Accepted Solutions
rustyfishbones
Master II
Master II

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

View solution in original post

8 Replies
Not applicable

rustyfishbones
Master II
Master II

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
Master II
Master II

Also check a video by Steve Dark on youtube called

Qlikview - Loading Data from Multiple Files

haymarketpaul
Creator III
Creator III
Author

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

haymarketpaul
Creator III
Creator III
Author

All filenames are completely different sadly

haymarketpaul
Creator III
Creator III
Author

Thanks - i'll take a look at that

rustyfishbones
Master II
Master II

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

myfolderstructure\*.csv

haymarketpaul
Creator III
Creator III
Author

Perfect - Thank you - easier than i thought