Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
vinayvishwanath
Contributor III
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
Specialist II
Specialist II

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
Specialist II
Specialist II

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.

vinayvishwanath
Contributor III
Contributor III
Author

Hi Gabor,

I have attached the test files as requested

undergrinder
Specialist II
Specialist II

thank you!

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

G.

vinayvishwanath
Contributor III
Contributor III
Author

thanks for the help really appreciated.