Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

yanivbm88
Contributor

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
New Contributor III

Re: Export table to .csv using STORE command in script

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.

21 Replies
thevingo
Contributor

Re: Export table to .csv using STORE command in script

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

yanivbm88
Contributor

Re: Export table to .csv using STORE command in script

Hi Govind,

Tried your suggestion, I get the following error:

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



thevingo
Contributor

Re: Export table to .csv using STORE command in script

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.

Re: Export table to .csv using STORE command in script

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
Contributor

Re: Export table to .csv using STORE command in script

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
Contributor

Re: Export table to .csv using STORE command in script

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
Contributor

Re: Export table to .csv using STORE command in script

Second file

Re: Export table to .csv using STORE command in script

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
Valued Contributor

Re: Export table to .csv using STORE command in script

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

Community Browser