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: 
Anonymous
Not applicable

How can I check if a file exists ?

Dear all,

is it possible to verify if a file exists or not ?

Thanks in advance

1 Solution

Accepted Solutions
Not applicable
Author

LET vListqvdexists=isnull(QvdCreateTime('File.qvd'));  // if qvd exists then 0 else -1

//if Qvd is exist then Delta loading Else Initial Loading.

Regards-Bika

View solution in original post

9 Replies
sujeetsingh
Master III
Master III

Consider this script it may help you

SET vFileName='C:\Users\Sheet.txt';

Let vFileExsist=if(FileSize($(vFileName))>0,-1,0);

if $(vFileExsist) then

Table1:

load * from $(vFileName)

(ooxml,no labels,table is[]);

Else

Load

MsgBox('File Not Found') as Warning1;

End if;

sujeetsingh
Master III
Master III

you can go to following thread they will help you.

http://community.qlik.com/thread/28381

http://community.qlik.com/message/340253#340253

Hope it will help you

Not applicable
Author

LET vListqvdexists=isnull(QvdCreateTime('File.qvd'));  // if qvd exists then 0 else -1

//if Qvd is exist then Delta loading Else Initial Loading.

Regards-Bika

Anonymous
Not applicable
Author

Thanks !!

smoon63
Partner - Creator
Partner - Creator

To make the variable act as a Boolean value, add "not" before isnull:

LET vListQVDExists = not isnull(QVDCreateTime('File.qvd'));

Now you can use

     IF $(vListQVDExists) THEN...

instead of

     IF $(vListQVDExists) = 0 THEN...

Hope that makes it easier,

Scott

Not applicable
Author

Hi ,

Is it possible to check and not to load a sheet in excel file which is not existing ?

I have a situation in which in one excel file have couple of sheets. First and second sheets are on monthly bases, but third is on quarterly base. I would like to load first two and check if third is existing . If not skip and load other sheets, if exist load all.

I attach a sample excel file.

Thanks in advance

Anonymous
Not applicable
Author

i ilke the way you formulated your answer. clear, usefull and concrete

cspindley
Contributor III
Contributor III

thank you for your help with this, i am up and running again ...

Kostan
Contributor
Contributor

You can check it with FileList():

 

LET vFileName='/A/B/C.D';

LET vFileExist=0;

FOR Each vFile in FileList('$(vFileName)')

     LET vFileExist=1;

Next vFile;

IF (vFileExist = 1) THEN

     TRACE File exists;

ELSE

    TRACE File does not exist;

END IF