Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
yink-hpv
Contributor III
Contributor III

export data through Script

Hi Community:

i have a table below loaded in Qlik Sesne, is there any we i can export them to individual excel file by using script

 

regioncountrysales
aaa112
bbb236
ccv259
ddg658

i would like to export by region, so each of region get a single excel file, many thanks

1 Solution

Accepted Solutions
DavidŠtorek
Creator III
Creator III

Hi, just do it like this

[your_table]:

LOAD "region"

FROM [lib://<your path>]...;


For each region in FieldValueList('region')

Data:

Load

region,country,sales

FROM [lib://<your path>]...

where region='$(region)';
Store Data into [lib://<your path>\<your file name>-'$(region)'.csv] (txt);
   

Next region

drop table [your_table];

View solution in original post

7 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

You can run the for loop and create CSV for each region, using the Store command.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
dapostolopoylos
Creator III
Creator III

Script side, i don't think there is a way to store to excel...

You can do it by macro on post reload event or maybe you can store in the script in csv with a statemenet something like that

Store  Source into Source_new.txt (txt);



check out this conversation: Store in Excel

Father/Husband/BI Developer
yink-hpv
Contributor III
Contributor III
Author

Hi Kaushik: would you mind share scrip for loop, thanks

DavidŠtorek
Creator III
Creator III

Hi, just do it like this

[your_table]:

LOAD "region"

FROM [lib://<your path>]...;


For each region in FieldValueList('region')

Data:

Load

region,country,sales

FROM [lib://<your path>]...

where region='$(region)';
Store Data into [lib://<your path>\<your file name>-'$(region)'.csv] (txt);
   

Next region

drop table [your_table];

yink-hpv
Contributor III
Contributor III
Author

thanks david, it is work. thanks heaps

DavidŠtorek
Creator III
Creator III

I am glad to help you . Please mark response as correct to help allso other users.

pablolabbe
Luminary Alumni
Luminary Alumni

Don't forget !


When applicable please mark the appropriate replies as CORRECT https://community.qlik.com/docs/DOC-14806. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads as HELPFUL if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads as HELPFUL if you feel additional info is useful to others.