Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
m_perreault
Creator III
Creator III

Load File Name without loading whole file

Hi All,

I am using a for loop to load all files in a directory.  The file sizes very but some are quite large.  I want load just the file name from each file so my script is the below.  However even though I am loading just the filename I am still loading all the records in each file which can take a while.  Is there a way for me to load just the file name without loading all records in the file?

For Each File in FileList('lib://Qlik Control Data/*.xlsx');

LOAD

FileBaseName() as FileName

FROM ['$(File)']

(ooxml, embedded labels, table is Table1);

Next File

Thanks,
Mark

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Try this:

For Each File in FileList('lib://Qlik Control Data/*.xlsx');

     LET vFileName = SubField('$(File)','\',-1) ;

     LOAD '$(vFileName)' as FileName AutoGenerate 1;

Next File


talk is cheap, supply exceeds demand

View solution in original post

3 Replies
Gysbert_Wassenaar

Try this:

For Each File in FileList('lib://Qlik Control Data/*.xlsx');

     LET vFileName = SubField('$(File)','\',-1) ;

     LOAD '$(vFileName)' as FileName AutoGenerate 1;

Next File


talk is cheap, supply exceeds demand
jobsonkjoseph
Creator III
Creator III

Hi Gysbert,

According to above script, what exactly the output would be. I havn't fiddled around much, hence the doubt.

Gysbert_Wassenaar

No idea, that depends on which files with the .xlsx extension exist in the folder that the data connection Qlik Control Data points to. The file names of those files should end up in a table in the field FileName.


talk is cheap, supply exceeds demand