Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

nikita23
New Contributor III

Loop to Load all excel Files with different headers

Hi All,

I have used below code to fetch all the excel files under single folder and its running fine but now i need to change it like 

2019 | Feb| a.xlsx|b.xlsx|c.xlsx etc

but now sheet a and c starts with header 2 and B sheet with header 3 then how to change the existing code and store it into qvd.

 

let vYear= Year(Today());


SUB Scanfolder(Root)

For each FileExtension in 'xlsx'

FOR Each FoundFile in FileList(Root &'\*.'& FileExtension)

T1:

// Calling Variable For current year

LOAD *
FROM

[$(FoundFile)]

(ooxml, embedded labels, table is Tabelle1);

Next FoundFile

NEXT FileExtension

For Each SubDirectory in DirList (Root & '\$(vYear)\*' )

Call ScanFolder(SubDirectory)

Next SubDirectory

End Sub

Call ScanFolder('lib://SharePath(ho_a)') ;

I will be grateful for any help!

Many thanks in advance!