Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
polisetti
Creator II
Creator II

Dynamic file name

Hi ,

i am fetching data from different XL Sheets (like Sales,product,XXX,YYY ) into the qlikview .Now the issues is i want to know the file name from which data is coming in the UI ..Please give any ideas..

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Add a string with the sheetname as a new field SheetName:

MyData:

LOAD *, filename() as FileName, 'Sheet1' as SheetName

FROM C:\MyExcelFile.xls

(biff, embedded labels, table is Sheet1$);

But perhaps you're looking for something like this: Loading from multiple Excel files and multiple sheets. In that piece of code you can use the variable vFile and zSheet:

LOAD *, '$(vFile)' as FileName, '$(zSheet)' as SheetName

FROM [$(vFile)] (ooxml, no labels, table is [$(zSheet)]);


talk is cheap, supply exceeds demand

View solution in original post

4 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Basically use the filename() function:

Load *, filename() as Filename

from ...

See the File Functions section in the help file for more details and other useful file functions.


talk is cheap, supply exceeds demand
polisetti
Creator II
Creator II
Author

Sorry i forget 1 point .In a same XL sheet i have different tabs.So can we get from which tab it was coming..


Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Add a string with the sheetname as a new field SheetName:

MyData:

LOAD *, filename() as FileName, 'Sheet1' as SheetName

FROM C:\MyExcelFile.xls

(biff, embedded labels, table is Sheet1$);

But perhaps you're looking for something like this: Loading from multiple Excel files and multiple sheets. In that piece of code you can use the variable vFile and zSheet:

LOAD *, '$(vFile)' as FileName, '$(zSheet)' as SheetName

FROM [$(vFile)] (ooxml, no labels, table is [$(zSheet)]);


talk is cheap, supply exceeds demand
polisetti
Creator II
Creator II
Author

Thank you ,

But if i have more sheet ,like consider 50 sheets ,Is there is any solution.