Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
ankit777
Specialist
Specialist

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
Specialist
Specialist
Author

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

View solution in original post

10 Replies
sujeetsingh
Master III
Master III

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

ankit777
Specialist
Specialist
Author

If possible can you give the code for the same?

brijesh1991
Partner - Specialist
Partner - Specialist

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
Specialist
Specialist
Author

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
Partner - Specialist
Partner - Specialist

Reload the attached file

ankit777
Specialist
Specialist
Author

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
Partner - Specialist
Partner - Specialist

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

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

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
Specialist
Specialist
Author

Hi Steve,

I would like to know more about NPrinting.