0 Replies Latest reply: Sep 5, 2017 4:57 PM by Paul Sparrow RSS

    How to load multiple files from a folder connection

    Paul Sparrow

      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);