Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to get each files in a directory

Hello,

Actually, I try to make a script to allow me to convert each XLSX in QVD.

FOR EACH File in FileList([ftp://AAA:VVV@11.111.11.111/DV/])

XLSX:

LOAD

  *

FROM [ftp://AAA:VVV@11.111.11.111/DV/*.xlsx] (txt, codepage is 1252, embedded labels, delimiter is ';', no quotes);

STORE XLSX into $(File).qvd(qvd);

next File

When I made it run there's any error but nothing appears too. I don't know if I use the "FOR EACH" well or not and the "FROM".

Then, if someone can explain my error.

Thanks

Regards

11 Replies
prieper
Master II
Master II

How would the script look like for just one file? Using the wizard may then allow you to take the steps for an automation.

Am not sure, whether the datatype is appropriate - you mention as filextension "xlsx", but specify that it should be txt?

What does the error-message say - sometimes it gives already an hint, what might be wrong.

Peter

Not applicable
Author

Hi Peter,

My script for one file:

XLSX:

LOAD

  *

FROM [ftp://AAA:VVV@11.111.11.111/DV/Data%20Entry.xlsx] (txt, codepage is 1252, embedded labels, delimiter is ';', no quotes);

STORE XLSX into XLSX.qvd(qvd);

For the datatype, I have xlsx for Microsoft Excel

There's not error message, that's why I don't really know what I can do to fix that. (First script I sent to this post)

I think that my script doesn't read my FTP's address because with this script:

XLSX:

LOAD

*

FROM [ftp://AAA:VVV@11.111.11.111/DV/*.xlsx]

(txt, codepage is 1252, embedded labels, delimiter is ';', no quotes);

STORE XLSX into XLSX.qvd(qvd);

I have this message: "Cannot open file"

Thanks for your help

vvvvvvizard
Partner - Specialist
Partner - Specialist

store th directory on ur desktop and run script , this will tell u whether it is a ftp issue

petter
Partner - Champion III
Partner - Champion III

I am pretty sure FileList( ) does not support FTP as filesystem. FileList() only enumerate files on a Windows regular filesystem.

and likewise

FROM

does not support FTP as a filesystem which can accept wildcards...

prieper
Master II
Master II

If you stop the script before the STORE ....command,

do you really have valid data loaded?

typically you should load an Excel-file with params like

(ooxml, embedded labels, table is Sheet1);

Peter

Not applicable
Author

Hi Kenny,

I have some models using similar logic and your script looks fine with one exception.

As Peter mentioned, you need to specify a sheet in the workbook via the table parameter or else the script has nothing to process hence no results.

This means you need you to update the following section to be something like:

(txt, codepage is 1252, embedded labels, delimiter is ';', no quotes, table is [My Sheet]);

Hope this helps.

Kind regards,

Rod

Not applicable
Author

I stop my script before the STORE nothing loaded and I changed my params.

As Petter Skjolden said, my script cannot read my Filelist() because of FTP.

Do you know another way to load excel files without Filelist or For each ?

Not applicable
Author

If Filelist() doesn't support FTP, do not exist another way to load?

Not applicable
Author

I think my script don't really read in my FTP, because when I run nothing load. Do you use Filelist on your models ?