Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Associationg a date to an Excel Import

Hey,

I have been looking for an answer to this question for quite a while now and couldn't find a proper answer.

Already apologizing for any "stupid" questions, I am pretty new to QlikView...


My problem:

I want to import Excel-Sheets on a monthly basis into QV. The sheets do not contain any information about the date but in the filename.

In Qlikview I would like to associate each sheet with the corresponding month (for sorting reasons).

Maybe I could edit the Excel file in some way, that makes this possible but I would rather like to avoid doing so.

I would be really glad, if someone could help me out.

Thank you very much, Thees.

1 Solution

Accepted Solutions
whiteline
Master II
Master II

The whole path and filename with extension.

$(File) - substitutes there the value of the variable File. As it's string and can contain spaces use ''.

You can watch for variables in Debug mode (Button on top of the Stript editor).

Also you can run your script step by step.

You can also specify a directory in filelist ('SomeDir\*.xlsx').

You can use relative paths if you've used Directory; statement somwhere above (see help).

View solution in original post

3 Replies
whiteline
Master II
Master II

If you have some files with the same structure you can use this (just modify your existing load):

for each File in filelist ('*.xlsx')

     LOAD

        '$(File)' as FileName,

        SomeField1,

        SomeField2,

        ...

     FROM

     SomeExcelFile.xlsx

     [$(File)]

     (ooxml, embedded labels, table is Sheet1);

Next File;

Now you can also extract your date from the filename string '$(File)' with a string functions.

Not applicable
Author

Thank you for the reply this is exactly what i was looking for!

One question for my understanding:

Does '$(File)' mean the whole path or just the filename?

whiteline
Master II
Master II

The whole path and filename with extension.

$(File) - substitutes there the value of the variable File. As it's string and can contain spaces use ''.

You can watch for variables in Debug mode (Button on top of the Stript editor).

Also you can run your script step by step.

You can also specify a directory in filelist ('SomeDir\*.xlsx').

You can use relative paths if you've used Directory; statement somwhere above (see help).