Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
_fl
Contributor
Contributor

STORE TABLE TO CSV

Hi,

I need to export a table (created from a concatenation of several files) from QlikSense to .csv format.

I tried the code below:

For each file in FileList ('lib://DIRECTORY/*file_name*.xlsx')
"TABLE":
LOAD * FROM [$(file)] (ooxml, embedded labels, table is sheet1);
NEXT;

STORE "TABLE" INTO lib://DIRECTORY/file_name.csv (txt);

 

The problem is that the file_name.csv created is way too big compared to the input (8 excel files for a total of 50MB generate a .csv for 1600MB) and it crashes when I open it.

I tried also deleting the '(txt)' but the .csv comes out in a format I can't understand.

Thank you very much for your help!

1 Solution

Accepted Solutions
JordyWegman
Partner - Master
Partner - Master

Try the auto concatenate again, but then with the following Store statement:

STORE [YourField] FROM MyTable
INTO ..\[YourPath]\MyCSVFile.csv (txt);

By doing this you only will save one field. Do this field by field a see which one is giving the problem.

Jordy

Climber

Work smarter, not harder

View solution in original post

9 Replies
Seyko
Partner - Creator
Partner - Creator

Hello,
Before storing this file, did you check on Qlik (with an table or by the data manager) if the created table was according to your expectations? I guess all tables are exactly the same fields (your goal being automatic conactenation with regard to your script)?

cordially.
Excuse my english, i'm french!
_fl
Contributor
Contributor
Author

Hello,

Yes, all the file uploaded have the same structure, so they concatenate easily in the only TABLE.

I also tried to create a table with all the dimensions and the resulting excel dimension is basically the sum of the input files (but I can't use this method because I need to work on a different set of data from excels with hundreds of columns...)

Thanks

 

JordyWegman
Partner - Master
Partner - Master

What happens when you store it in a QVD? Does it get the same size?

Jordy

Climber

Work smarter, not harder
Seyko
Partner - Creator
Partner - Creator

Okay. Make the load and concatenation without this loop (a little boring for 8 files) and see if the problem persists. If not, you need another setting for your loop.

Waiting for your return.
Excuse my english, i'm french!
_fl
Contributor
Contributor
Author

Hi,

If I store the 50 MB excels into a .qvd the size is 8MB.

_fl
Contributor
Contributor
Author

Hi,

I tried uploading the files 1 by 1 but the result didn't change (still 1.6GB .cvs file).

JordyWegman
Partner - Master
Partner - Master

Try the auto concatenate again, but then with the following Store statement:

STORE [YourField] FROM MyTable
INTO ..\[YourPath]\MyCSVFile.csv (txt);

By doing this you only will save one field. Do this field by field a see which one is giving the problem.

Jordy

Climber

Work smarter, not harder
Seyko
Partner - Creator
Partner - Creator

Try this :

  1. Use your loop and store file to qvd format (8 MB)
  2. Reload this qvd in your application and store it in csv format.

If you obtain the same preceding file size (1600 MB), it may be normal (especially since you have a lot of columns, it requires a lot of memory).

cordially.

Excuse my english, i'm french!
_fl
Contributor
Contributor
Author

I tried that way and I found the column (out of hundreds..) that takes about 90% of the space!

Thank you!