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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Check If Excel file exists

Hi,

I want to check the existance of an excel file in a relative path in between 2 LOAD scripts which are being CONCATENATED.

Eg.

Table1:

LOAD * FROM ExcelA;

CHECK FILE(ExcelB) and If exists then

CONCATENATE(Table1)

LOAD * FROM ExcelB;

Could anyone help on how this can be achieved in QV script.

Thanks.

Labels (1)
1 Solution

Accepted Solutions
Nicole-Smith

I think you need to write the filetime() piece like this:

FileTime('..\Files\ExcelB.xlsx')

View solution in original post

8 Replies
Nicole-Smith

Table1:

LOAD * FROM ExcelA;

IF FILETIME(ExcelB)>0 THEN

     CONCATENATE(Table1)

      LOAD * FROM ExcelB;

END IF

Anonymous
Not applicable
Author

Hi Smith,

I have tried the above script, but it is not working

Used Debugger but the loop is not going insisde IF condition.

Table1:

LOAD * FROM ExcelA;

IF FileTime([..\Files\ExcelB.xlsx]) THEN

CONCATENATE(Table1)

LOAD * FROM ExcelB;

END IF

Please let me know whether the above script is correct. Specifically the syntax for file path.

Also, I have checked the 'Relative paths' check box.

Nicole-Smith

Try just loading from the file using the path like you have written:

Table1:

LOAD * FROM ExcelA;

CONCATENATE(Table1)

LOAD * FROM [..\Files\ExcelB.xlsx];

Does this work?

Anonymous
Not applicable
Author

Hi Smith,

In normal LOAD the file is fetched from the path which I have mentioned above.

But in the IF statement the condition gets failed and coming out of loop.

I am using the same path in the IF statement as like used in the LOAD.

Nicole-Smith

I think you need to write the filetime() piece like this:

FileTime('..\Files\ExcelB.xlsx')

hic
Former Employee
Former Employee

I would do the following:

Table1:

LOAD * FROM ExcelA;

For each vFileName in FileList('C:\Path\ExcelB.xls')

   CONCATENATE(Table1)

   LOAD * FROM [vFileName];

Next vFileName

HIC

Anonymous
Not applicable
Author

Thanks Smith...Its working fine now.

Anonymous
Not applicable
Author

Thanks for your reply Henric.