

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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!
- « Previous Replies
- Next Replies »
Accepted Solutions


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
STORE TableName into C:\Path\TableName.csv(txt);


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Govind,
Tried your suggestion, I get the following error:
This statement only works with lib:// paths in this script mode


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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)


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Second file


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Have you tried giving it a fully qualified path name? Like C:\SomeDir\SomeOtherDir\testcsv.csv(txt)

- « Previous Replies
- Next Replies »