Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
paulsparrow
Contributor III
Contributor III

How to load multiple files from a folder connection

In QlikView I would run a loop to collect all the file names under a folder then use that to loop in and grab all the data.  In Qlik Sense I've mapped a folder connection to the folder but I don't know how to get the data out of the folder:

LET vFilePath = '$(vEBIFiles)';

searchStr = '\*.xlsx*'; 

rootPath = '$(vFilePath)';

SUB DoDir (Root)

  FOR EACH File IN FILELIST (Root&searchStr)

EBI_WeeklyFiles:

Load

'$(File)' as PathName,

'$(Root)' as Folder,

mid('$(File)',index('$(File)','\',-1)+1,len('$(File)')-index('$(File)','\',-1)) as FileName,

right('$(File)',len('$(File)')-index('$(File)','.',-1)+1) as FileExt,

Filesize('$(File)') as Size,

Filetime('$(File)') as FileTime

autogenerate 1;

next File

For Each SubDirectory in Dirlist( Root & '\*' )  

      Call DoDir(SubDirectory)  

    Next SubDirectory

END SUB

CALL DoDir (rootPath);

0 Replies