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

Help in Scripting

Hi All,

Is it possible to load the filenames of the files present in a folder irrespective of whether it is in csv, xls or xlsx format.

Thanks,

Asma

3 Replies
datanibbler
Champion
Champion

Hi Asma,

sure it is possible. Have a look at the Filename() and related functions. You can parse through all that is inside a directory and find out the name, filetype or others.

HTH

jpenuliar
Partner - Specialist III
Partner - Specialist III

look up an example of For Each in Help(F1) Section

jpenuliar
Partner - Specialist III
Partner - Specialist III

FOR Each a in 1,3,7,'xyz'

LOAD * FROM file$(a).csv;

NEXT

// list all QV related files on disk

SUB DoDir (Root)

FOR Each Ext in 'qvw', 'qva', 'qvo', 'qvs'

FOR Each File in filelist (Root&' \*.' &Ext)

LOAD

'$(File)' as Name,

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

FileTime( '$(File)' ) as FileTime

autogenerate 1;

NEXT File

NEXT Ext

FOR Each Dir in dirlist (Root&' \*' )

call DoDir (Dir)

NEXT Dir

ENDSUB

CALL DoDir ('C:')