Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
sunny_talwar

Export to Excel Macro

Hi Qlikers

I am in a need for a macro which would be linked to a button action to export a particular table box object into a Excel file. I have seen many Macros on the community, but I am finding it hard to configure them for my need. I was wondering if somebody can provide a working sample of a macro which does the above mentioned thing.

Thanks in advance for your support.

Best,

Sunny

18 Replies
alexandros17
Partner - Champion III
Partner - Champion III

This is a very simple export:

SUB EXPORT
set sObject1 = ActiveDocument.GetSheetObject("CH_EXPORT")
sObject1.Export "E:\MyDoc.csv", ", "
end sub

CH_EXPORT is the name of the object containing the data (Your table)

rubenmarin

Hi Sunny, Alessandro answer is correct (as usual ). If you want more documentation there is an app with useful help about automation: QlikView Core COM API Guide - Version 11

petter
Partner - Champion III
Partner - Champion III

There is actually (at least) three more API-functions to do export:

ExportBIFF

ExportEx

ServerSideExportEx

Which gives you a selection of more paramters and file-formats....

sunny_talwar
Author

Thanks for a very quick response Alessandro Saccone. What if I want to open the data in Excel instead of saving it? This way I can let the user save it wherever they like it to be saved.

My another question is, will this button (with macro action) will work on the portal version or will this only work on the desktop version of the application?

Best,

Sunny

sunny_talwar
Author

I have looked at that qvw document, but somehow the only macro related to Export Excel I found seemed very complicated and it did not work for me. But thanks for sharing that information Ruben Marin

Best,

Sunny

sunny_talwar
Author

Thanks for your response Petter Skjolden‌, Is there any place I can see examples of them being implemented? I need the macro to open the excel file instead of saving it in pre-defined location. Is that possible? and will the macro work on the portal as well?

Best,

Sunny

petter
Partner - Champion III
Partner - Champion III

If you use the ServerSideExportEx it will be stored on the server as the API-function name implies. Then the location you store it to has to be a location that can be reached with a URL. That should be easy to configure or setup.

I am not sure if it is possible in the very same Macro to launch the URL though.

buzzy996
Master II
Master II

see attached in sheet1 export button..u have to modify a bit accordingly ur needs..but it won't work on access point,hopes helpful.

sunny_talwar
Author

No the image Shiva, need to export out the data from a table box. Can the macro be edited to do that?