Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

yink-hpv
New Contributor

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

Re: export data through Script

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];

7 Replies

Re: export data through Script

Hi,

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

Regards,

Kaushik Solanki

dapostolopoylos
Contributor III

Re: export data through Script

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

Re: export data through Script

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

DavidŠtorek
Contributor III

Re: export data through Script

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

Re: export data through Script

thanks david, it is work. thanks heaps

DavidŠtorek
Contributor III

Re: export data through Script

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

pablolabbe
Valued Contributor II

Re: export data through Script

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.

Community Browser