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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Reload automatically on a changing filename

Hi, I'm new on this community and therefore my question may have been already asked.

The application I'm developping requires to reload automatically a file with a name that change every day. :

Today the filename would be: "20140205_two.csv", tomorrow it will be "20140206_two.csv" as you can see the name in depending on the date.

The script that I want to include should reload the correct file depending on the current day.

Thank you in advance.

1 Solution

Accepted Solutions
Nicole-Smith

Let vFile = date(today(), 'YYYYMMDD') & '_two.csv';

YourTable:

LOAD *

FROM $(vFile);

View solution in original post

9 Replies
MK_QSL
MVP
MVP

Instead of file name you can write "*_two.csv"

giakoum
Partner - Master II
Partner - Master II

You could use the following syntax :

for each file in filelist(????????_two.csv)

load

*

from $(file)

please check syntax, this is just an example

Nicole-Smith

Let vFile = date(today(), 'YYYYMMDD') & '_two.csv';

YourTable:

LOAD *

FROM $(vFile);

MK_QSL
MVP
MVP

Example Given Below...

Instead of this

LOAD Column1,

          Column2

FROM

(ooxml, embedded labels, table is Sheet1);

ashwanin
Specialist
Specialist

Please use like this

LOAD

abc,

def

FROM

[C:\Documents and Settings\Ashwani\Desktop\2014*.csv

(ooxml, embedded labels, table is Sheet1);

See i have used  ' *'  due to this qv will load all the csv files starting with 2014. Now date change does not impact you.

If it not works then please let me know.

Not applicable
Author

Your answer is exactly what I asked for but I have another issue the real name is:
"20140204_two_201402051420114745.csv" (the last numbers can be assimilated as randomised) I pretentiously thought I could used your answer and modify it like this:

" Let vFile = date(today()-1, 'YYYYMMDD') & '_two' & '*.csv'; "

I tried to use the star without the quotes, with a "\", or after the FROM but each time I failed.

Thank you very much

Nicole-Smith

Try like this:

Let vFile = date(today(), 'YYYYMMDD') & '_two_';

YourTable:

LOAD *

FROM $(vFile)*.csv;

Not applicable
Author

Thank you so much!
It exactly what I was looking for.

Nicole-Smith

I'm glad it works for you!