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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Autoloading a file


I apologise if this has been answered multiple times, however I am still trying to get to grips with the behind the scenes of Qlikview.

Problem:

I have a file that is generated into a directory. The directory gets cleaned everytime there is a new file created so that there is only one file in there at any one given time. However the file names changes every time it is created. I need to load this file into qlikview without having to change the code every time. The file format and fields does not change. So an example of files can be:

\\temp\allocation\zzzalldata-2013-12-24.xlsx or

\\temp\allocation\zzzalldata-2014-01-01.xlsx etc.....

Question:

Is there a way in Qlikview to load a file from a specified directory without knowing the file name. So I know the directory is \\temp\allocation\. I know that the last part contains a date and I want to extract that from the file name as well, so I know when the file was created. I would hope someone would help me code this.

Current code example:

Directory;

Load a,

        b,

        c

FROM

[temp\allocation\zzzalldata-2013-12-25.xlsx]

(ooxml,embedded lables, table is [report$]);

Thank you very much for your assistance

1 Solution

Accepted Solutions
mr_janne
Contributor III
Contributor III

Hi,

if the folder really has only a one file then you can use the wildcard at the filename:

Directory;

a,
b,
c,
date#(keepchar(filebasename( ),'0123456789'),'YYYYMMDD') as X
FROM
[temp\allocation\*.xlsx]
(
ooxml,embedded labels, table is [report$]);

regards.janne

View solution in original post

2 Replies
mr_janne
Contributor III
Contributor III

Hi,

if the folder really has only a one file then you can use the wildcard at the filename:

Directory;

a,
b,
c,
date#(keepchar(filebasename( ),'0123456789'),'YYYYMMDD') as X
FROM
[temp\allocation\*.xlsx]
(
ooxml,embedded labels, table is [report$]);

regards.janne

Siva_Sankar
Master II
Master II

Like the attached one...It used macro.

Regards.

Siva