Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
yanivbm88
Creator
Creator

Export table to .csv using STORE command in script

Hi,

My goal is to export a full table to .csv file. In addition, I want to add a delimiter which I determine.

I understood the best/easiest way to do so in Qlik Sense is by using STORE command in the script. No need for VBA macros.

Does anybody have suggestions for the exact syntax?

Thanks!

1 Solution

Accepted Solutions
HarishG
Partner - Contributor III
Partner - Contributor III

The issue occurs in your Data connection 'lib://Microsemi EDI_Schema (win-n5h9rv84sq3_administrator).


When you are using single quotes (' ') in the store command for your path, the sense is storing the data in xml, in order to exclude ' ' , avoid the spaces in between the data connections folder or make sure you avoid (win-n5h9rv84sq3_administrator) in the folder data connection name. it will work.

For eg, you Script and Store should command should be as shown below :


DimKanban:

LOAD

    KanbanCode,

    SubcontractorCode,

    SupplierCode,

    StateCode,

    CountryCode,

    City,

    KanbanName,

    VendorCode,

    IsKanbanBlocked,

    Continent,

    CountryName,

    EuropeanRegion,

    Region,

    CountryTimeZone,

    StateName,

    StateTimeZone,

    SupplierName,

    SupplierType,

    SubcontractorName,

    Plant,

    Sloc

FROM [lib://ServerLogFolder/DimKanban_Temp1.qvd]

(qvd);

Store DimKanban into lib://ServerLogFolder/testcsv12.csv (TXT);


And also i have attached the output csv file from this store command.

View solution in original post

21 Replies
thevingo
Creator
Creator

STORE TableName into C:\Path\TableName.csv(txt);

yanivbm88
Creator
Creator
Author

Hi Govind,

Tried your suggestion, I get the following error:

This statement only works with lib:// paths in this script mode



thevingo
Creator
Creator

My mistake, QS work on libraries

try

STORE TableName into TableName.csv(txt); //I think this will store in same folder where your app is stored.

avinashelite

In Qliksense for any folder you need add an connection/lib path for that ...go to edit script > to the right you will see an option folder > select and add the desired folder location then while storing use the connection name for it or simply the lib path its will store automatically


Hope this helps you

yanivbm88
Creator
Creator
Author

Hi Govind,

Unfortunately, still no success. See error below (In the script I have a semicolon at the end of the phrase).

I also tried the following syntax without success:

Store * From DimKanban into testcsv.csv(txt);

Error here:

No qualified path for file: ***

The error occurred here:

Store DimKanban into testcsv.csv(txt)

yanivbm88
Creator
Creator
Author

Hi Avinash,

Actually, I tried this before and indeed a CSV file was generated. However, it's format is very strange.

I also tried exporting to a .txt file

I attach the files for your reference.

yanivbm88
Creator
Creator
Author

Second file

avinashelite

Could you share the complete script please ? I suspect the data is been converted to XML format that is the reason your getting this output

JustinDallas
Specialist III
Specialist III

Have you tried giving it a fully qualified path name?  Like C:\SomeDir\SomeOtherDir\testcsv.csv(txt)