Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Howto: Load all excel files in a directory and use part of filename as inserted value

I would like to load all excel files in a directory (growing by one file every day) - and use part of the file name (date)

as a inserted value in the table - Below is a manual example of a single file - that I today repeat for every file....

...must be a smarter way of just loop thru the files and dynamically create the LoadDate ? 🙂

LOAD

  '2015/12/20' As LoadDate,

    Number,

    Number1,

    Priority,

    State

FROM [lib://somedata/daily_2015-12-20.xls]

(biff, embedded labels, table is [Page 1$]);

2 Replies
m_woolf
Master II
Master II

LOAD

  left(subfield(FileName(),'_',2),10) As LoadDate,

    Number,

    Number1,

    Priority,

    State

FROM [lib://somedata/*.xls] 

(biff, embedded labels, table is [Page 1$]);

reddy-s
Master II
Master II

Hi Richard,

Try this :

sub ScanFolder(Root)

          for each FileExtension in 'qvw','mp3','ape','flac','ogg'

                    for each FoundFile in filelist( Root & '\*.' & FileExtension)

                              FileList:

                              Load

                                        '$(FoundFile)'                     as [FilenameWithPath],

                                        '$(FileExtension)'           as [Extension]

                              Autogenerate(1);

                    next FoundFile

          next FileExtension

          for each SubDirectory in dirlist( Root & '\*' )

                    call ScanFolder(SubDirectory)

          next SubDirectory

end sub

Call ScanFolder('.') ;

Thanks and Regards,

Sangram Reddy.