Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
ankit777
Valued Contributor

Export table to excel during reload

How can I export a table in Qlik view to excel sheet during reload.?

1 Solution

Accepted Solutions
ankit777
Valued Contributor

Re: Re: Export table to excel during reload

The following code creates the Excel sheet in correct format.

sub Export

set obj1 = ActiveDocument.GetSheetObject("TB01")

obj1.ExportBiff "C:\Documents and Settings\596732\Desktop\manasvi\InnerJoin.xls"

msgbox("Done")

end sub

10 Replies
sujeetsingh
Honored Contributor III

Re: Export table to excel during reload

u can use a macro and call the macro in the script and execute it but may be i am not sure .

ankit777
Valued Contributor

Re: Export table to excel during reload

If possible can you give the code for the same?

brijesh1991
Valued Contributor

Re: Export table to excel during reload

Write the below macro(Ctrl+M)

-------------

sub Export

set obj1 = ActiveDocument.GetSheetObject("TB01")

obj1.Export "D:\InnerJoin.xls",4

msgbox("Done")

end sub

-----------

Goto Document Properties--->Trigger---->OnPostReload--->Add Action--->Add---> External--->Run Macro---> give macro name(Export)

ankit777
Valued Contributor

Re: Export table to excel during reload

I am putting a semi colon after

msgbox("Done")

But the code is not creating any excl sheet.

Also can u tell me the significance of 4 in

obj1.Export "D:\InnerJoin.xls",4

brijesh1991
Valued Contributor

Re: Re: Export table to excel during reload

Reload the attached file

ankit777
Valued Contributor

Re: Re: Export table to excel during reload

The following code creates the Excel sheet in correct format.

sub Export

set obj1 = ActiveDocument.GetSheetObject("TB01")

obj1.ExportBiff "C:\Documents and Settings\596732\Desktop\manasvi\InnerJoin.xls"

msgbox("Done")

end sub

brijesh1991
Valued Contributor

Re: Re: Export table to excel during reload

Cheers!!!!!!!!!!!!!!

MVP
MVP

Re: Export table to excel during reload

Hi Ankit,

You are limited in what you can do during the reload script with regards to firing a macro to write to Excel.  Firing a macro like the one above will be fine on post reload - but I'm not sure it will fire correctly if refreshed from QlikView Server.

The simplest way to export data for use in Excel during reload is to do it as a CSV file, a simple store statement can be used to do this:

STORE TableName INTO .\DataFile.csv (txt);

If you want formatted Excel output then you need to look at a product such as NPrinting, which allows you to write to a pre-defined template, with headers, different fonts and multiple tabs.

Please get in touch if you would like more information about NPrinting.

Hope that helps,

Steve

ankit777
Valued Contributor

Re: Export table to excel during reload

Hi Steve,

I would like to know more about NPrinting.

Community Browser