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: 
Not applicable

Export To excel

How to export Qlikview reports to Excel?

5 Replies
Gabriel
Partner - Specialist III
Partner - Specialist III

Hi

See if the attached helps

Under Tool > Edit Module, ensure that you have 'System Acces' selected under 'Requested Module Security' and 'Allow System Access' selected under 'Current Local Security' before clicking the 'Export to Excel' button. This is probably why your macros weren't running before.

Regards,

Gabriel

Not applicable
Author

Thanks Gabriel,

I want to export multiple sheets(2 or 3) and multiple sheet objects to export in excel.

And objects should look like as they are placed in qlikview.

If you have such qlik report in you then please send it to me.

Gabriel
Partner - Specialist III
Partner - Specialist III

Hi,

try below

http://community.qlik.com/message/319277#319277.

sub test

'Set the path where the excel will be saved

     filePath = "C:\Test.xls"

     'Create the Excel spreadsheet

     Set excelFile = CreateObject("Excel.Application")

     excelFile.Visible = true

     'Create the WorkBook

     Set curWorkBook = excelFile.WorkBooks.Add

     'Create the Sheet

     'first chart object

     Set curSheet = curWorkBook.WorkSheets(1)

'loop

chartArray = Array("CH06","CH09", "CH10")

usedRows=0

For Each chart In chartArray

   Set i = ActiveDocument.GetSheetObject(chart)

    chartCaption = i.GetCaption.Name.v

    curSheet.Cells(usedRows+1, 1)=chartCaption

     i.CopyTableToClipboard true

     curSheet.Cells(usedRows+3, 1).Select

     curSheet.Paste

     usedRows=curSheet.UsedRange.Rows.Count+3 --->function to get the first unused row

Next

'loop end

excelFile.Visible = true

'Save the file and quit excel

     curWorkBook.SaveAs filePath

     curWorkBook.Close

     excelFile.Quit

     'Cleanup

     Set curWorkBook = nothing

     Set excelFile = nothing

end sub

Anonymous
Not applicable
Author

Hi,

Thanks for the code.

I am getting following error.

Object required: 'i'

and

Paste method of Worksheet class failed

Can you share me the qvw file itself.

thanks.

Not applicable
Author

Hi

Please check the scripts hope it will work...

http://community.qlik.com/thread/32726?tstart=0

Qlikview application> Edit Module>Paste below code, ensure you have  'Allow System Access' selected >Test>OK 

click the 'Export to Excel' button in ur application sheet.

Sub ExcelExpwCaption
     'Set the path where the excel will be saved
     filePath = "C:\Test.xls"

     'Create the Excel spreadsheet
     Set excelFile = CreateObject("Excel.Application")
     excelFile.Visible = true
     'Create the WorkBook
     Set curWorkBook = excelFile.WorkBooks.Add
     'Create the Sheet
     Set curSheet = curWorkBook.WorkSheets(1)

     'Get the chart we want to export
     Set tableToExport = ActiveDocument.GetSheetObject("CH01")
     Set chartProperties = tableToExport.GetProperties
     tableToExport.CopyTableToClipboard true

     'Get the caption
     chartCaption = tableToExport.GetCaption.Name.v
     'MsgBox chartCaption

     'Set the first cell with the caption
     curSheet.Range("A1") = chartCaption
     'Paste the rest of the chart
     curSheet.Paste curSheet.Range("A2")
     excelFile.Visible = true

     'Save the file and quit excel
     curWorkBook.SaveAs filePath
     curWorkBook.Close
     excelFile.Quit

     'Cleanup
     Set curWorkBook = nothing
     Set excelFile = nothing
End Sub

Regards-Bika