Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
BARC’s The BI Survey 19 makes it official. BI users love Qlik. GET REPORT
vinayvishwanath
New Contributor III

How to segregate different multiple files in qliksense

Hi All,

i have multiple files to load in the format 201801, 201802........201812. which consists of required data in different columns eg: Budget and Forecast from 201801 to 201812.

My problem is : how to load the data with from multiple files without changing the script (it should load the latest files as well load old files also). 2. how to create a flag or label that upon selection returns value of the corresponding month. eg: if selection is done as 201804 then it has to return the corresponding values.

cumulative figures should also be available to show

Thanks

Vinay

1 Solution

Accepted Solutions
undergrinder
Valued Contributor II

Re: How to segregate different multiple files in qliksense

Hi Vinay,

This is from here -  Qlik Sense - Loop through Excel Files and Works... | Qlik Community

Try this:

sub ReadMultipleExcel (Root)

       For Each File in filelist (Root&'\*.xlsx')

            YourTable:

            Load  * FROM [$(File)] (ooxml, embedded labels, table is YourSheet)

       Next File

End Sub

Call ReadMultipleExcel ('lib://YourFiles')

It will loop through every xlsx file and read it's content.

As far as I get your state, you have same structured files, but other timestamp in filename.

The $(File) variable contains the filename, you can extract the date from it.

G.

you can loop through the files.

If I understand correctly the every file has a new column with the actual data, and retain the previous data as well?

Maybe you need only the last file right?

Can you provide us an example?

I think the crosstable option may help you in this case https://help.qlik.com/en-US/sense/June2018/Subsystems/Hub/Content/LoadData/work-with-cross-tables.ht...

G.

View solution in original post

4 Replies
undergrinder
Valued Contributor II

Re: How to segregate different multiple files in qliksense

Hi Vinay,

This is from here -  Qlik Sense - Loop through Excel Files and Works... | Qlik Community

Try this:

sub ReadMultipleExcel (Root)

       For Each File in filelist (Root&'\*.xlsx')

            YourTable:

            Load  * FROM [$(File)] (ooxml, embedded labels, table is YourSheet)

       Next File

End Sub

Call ReadMultipleExcel ('lib://YourFiles')

It will loop through every xlsx file and read it's content.

As far as I get your state, you have same structured files, but other timestamp in filename.

The $(File) variable contains the filename, you can extract the date from it.

G.

you can loop through the files.

If I understand correctly the every file has a new column with the actual data, and retain the previous data as well?

Maybe you need only the last file right?

Can you provide us an example?

I think the crosstable option may help you in this case https://help.qlik.com/en-US/sense/June2018/Subsystems/Hub/Content/LoadData/work-with-cross-tables.ht...

G.

View solution in original post

vinayvishwanath
New Contributor III

Re: How to segregate different multiple files in qliksense

Hi Gabor,

I have attached the test files as requested

Highlighted
undergrinder
Valued Contributor II

Re: How to segregate different multiple files in qliksense

thank you!

As I see every file contains every column, so the looping through files solve the problem

G.

vinayvishwanath
New Contributor III

Re: How to segregate different multiple files in qliksense

thanks for the help really appreciated.