Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
fishmanl
Contributor II
Contributor II

Loading csv files from multiple folders

Hi all,

I need to load same structure csv files from 3 different folders locatted in on folder.

(3 stores of , each has its own sales csv files)

Also i need to gave the option to choose how many days of csv files i am uploading. (Each csv by its creation date)

 

Thank you

1 Solution

Accepted Solutions
Vegar
MVP
MVP

For each _folder in 'LM' ,'LN','LT' 

For each _csv in filelist ('\\182.19.38.22\Data\BiFiles\$(_folder)\SalesDetail_*.csv')

If filetime('$(_csv)') > dayname(today() - 21) then

Load * from [$(_csv)] (txt);

End If

Next _csv

Next _folder

View solution in original post

5 Replies
Vegar
MVP
MVP

You can loop through files and folder using  for each loops. And use filetime() to check the date of your file. 

Try something like the sample I have typed below. 

For each _folder in 'location/1', 'location/2', 'location/3' 

For each _csv in filelist ('$(_folder) /*.csv')

If filetime('$(_csv)') > dayname(today() - 21) then

Load * from [$(_csv)] (txt);

End If

Next _csv

Next _folder

fishmanl
Contributor II
Contributor II
Author

thank you for the replay.

im kind new to Qlik , can you be more spacific please?

the main folder is: '\\182.19.38.22\Data\BiFiles\'

the 3 folders located in this main folder are: LM,LN,LT

and the files in each: SalesDetail_*.csv

can you please write the full syntacs? 

fishmanl
Contributor II
Contributor II
Author

and if its possible i want the folders to be in a var so i don't need to specific every location sparely 

Vegar
MVP
MVP

For each _folder in 'LM' ,'LN','LT' 

For each _csv in filelist ('\\182.19.38.22\Data\BiFiles\$(_folder)\SalesDetail_*.csv')

If filetime('$(_csv)') > dayname(today() - 21) then

Load * from [$(_csv)] (txt);

End If

Next _csv

Next _folder

fishmanl
Contributor II
Contributor II
Author

Thank you very much!