Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How can I check if a csv file physically exists?

I have a loop where I generate a filename based on a date-value. The filename is representing a csv-file which should be loaded with a load statement, for example LOAD log20100212.csv . But not all generate filenames do physically exist, so that the LOAD script run into an error.

Is there any possibility to check if a file physically exist before I try to use it for loading. In the most programming languages exist some functions like 'isfile()', checking if a file exist, but I found nothing equal in the script functions.

Has anyone an idea?

thanks Thomas

1 Solution

Accepted Solutions
Not applicable
Author

I've used the filesize function to determine the size of the file and then use the WHEN condition to load the file if the size > 0.

WHEN filesize('somefile.xlsx') > 0

SpreadsheetsA:

load *

from somefile.xlsx (ooxml, table is Sheet1 );

View solution in original post

3 Replies
Not applicable
Author

I've used the filesize function to determine the size of the file and then use the WHEN condition to load the file if the size > 0.

WHEN filesize('somefile.xlsx') > 0

SpreadsheetsA:

load *

from somefile.xlsx (ooxml, table is Sheet1 );

Not applicable
Author

Thanks - this helps!

Not applicable
Author

Can you loop this syntax for every 10 minutes, till it finds the file and then execute the load statement?