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

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Export to Excel doesnt work from load script

Hi All,

i found a few posts on the export functions but still couldn't get it to work from the load script...

i have a QV table that i want to export to Excel and send to email every morning using scheduler.

i created a function that save to Excel and another one that send the email.

both functions work when i call them from macro BUT when i add them to the loading script the save to Excel function doesn't work.

this is the save to Excel function (working from macro but not from the load script, i also tried the copy paste method but same result its working from the macro but not from the load script)

Function CopyToExcel ()

set XLApp = CreateObject("Excel.Application")

'XLApp.Visible = True

ActiveDocument.Sheets("SH01").Activate
set obj = ActiveDocument.getSheetObject("TB01")
XLApp.DisplayAlerts = False
obj.ExportBiff "C:\test.xls"

XLApp.Quit

End Function

this is the line i use at the end of my loading script to call the function:

LET vExecFunction = CopyToExcel();

any help will be greatly appreciated.

thanks

oz

1 Solution

Accepted Solutions
rbecher
MVP
MVP

Hi,

you could run a macro on the 'OnPostReload' trigger (see under Document Properties/Triggers).

- Ralf

Data & AI Engineer at Orionbelt.ai - a GenAI Semantic Layer Venture, Inventor of Astrato Engine

View solution in original post

5 Replies
rbecher
MVP
MVP

Hi,

you could run a macro on the 'OnPostReload' trigger (see under Document Properties/Triggers).

- Ralf

Data & AI Engineer at Orionbelt.ai - a GenAI Semantic Layer Venture, Inventor of Astrato Engine
Not applicable
Author

if you are running the reload from a batch file then use the /l option

start C:\"Program Files"\QlikView\qv.exe /l your.qvw

Not applicable
Author

hi Ralf,

thanks for the quick reply.

i wasn't aware of this functionality, its working great!

thank you for your help, this forum is a great!

oz

Not applicable
Author

hi Michael,

the /l option leaves the document open at the end of the reload (this might be a problem) but it also didn't solve the export problem.

i was able to get it to work by calling the macro from the OnPostReload triger.

thanks for your help

oz

Not applicable
Author

Hello, can you share the code that attaches the excel file to an email and sends it to a group of people ?

Thanks.