Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
Highlighted
ksharpes
New Contributor III

Add filenames from Folder into Table

I want to add the filenames from a folder into a table so i can loop through them to pull the data from them.

I have searched through a number of posts but none seem to work.

Any suggestions?

The folder is called "Jedox_Data"

I would expect it to be something like the below

for each file in filelist('lib://Jedox_Data/*.xlsm')

Filelist:

load

'$(file)' as Filename;

next file

 

 

 

 

 

1 Solution

Accepted Solutions
Highlighted

Re: Add filenames from Folder into Table

May be like this?

sub DoDir (Root)
      for each Ext in 'xlsm'
          for each File in filelist (Root&'\*.' &Ext)
              LOAD
              '$(File)' as FileName
              autogenerate 1;
          next File
      next Ext

      for each Dir in dirlist (Root&'\*' )
          call DoDir (Dir)
      next Dir
end sub

call DoDir ('lib://Jedox_Data') // Here, I assume that "Jedox_Data" is the connection name of that folder path

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)

View solution in original post

1 Reply
Highlighted

Re: Add filenames from Folder into Table

May be like this?

sub DoDir (Root)
      for each Ext in 'xlsm'
          for each File in filelist (Root&'\*.' &Ext)
              LOAD
              '$(File)' as FileName
              autogenerate 1;
          next File
      next Ext

      for each Dir in dirlist (Root&'\*' )
          call DoDir (Dir)
      next Dir
end sub

call DoDir ('lib://Jedox_Data') // Here, I assume that "Jedox_Data" is the connection name of that folder path

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)

View solution in original post