Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to export the chart data into excel using Button

Hi Experts,

I have Pivot table Data ,how to Export Excel using Button.

Thankls

11 Replies
Colin-Albert

No need for a button, just right-click the chart and select "Send to Excel" or export.

el_aprendiz111
Specialist
Specialist

Hi

1 Option

MACRO:

Sub Export_Pivot

Set Chart = ActiveDocument.GetSheetObject("CH02")
Set P = Chart.GetProperties
Chart.SendToExcel
End Sub


*** Actions Button

macr.png

Anonymous
Not applicable
Author

I tried it's not working , my script like below

sub Export_Stright

set chart = ActiveDocument.GetsheetObject("CH02");

set p = Chart.GetProperties;

set Chart.SendToExcel;

ENDSUB

TestData1:

LOAD

[Date],

[Client Name],

[ Type],

Replace(Replace(Replace(Replace(Replace(Replace(Replace( Type ,'GRP','Group Meeting'),'CCL','Conference Call'),'DINNER','Dinner'),'LUNCH','Lunch'),'BREAKFAST','Breakfast'),'GBR','Break'),'DINE','Dinner') as [Meeting Type Code],

Title,

Contact,

Status

Resident testData;

Drop table testData;

*** Actions Button

I fallow the above steps in Button..

devarasu07
Master II
Master II

Hi,

have you tried with attached method?

also take a look on Stephen Solution

QlikTip #32: Exporting multiple QV objects to a single Excel document

sasikanth
Master
Master

HI ,

Please try below code

Sub ExcelExport

    'Set the path where the excel will be saved

    filePath = "D:\Test.xlsx"

    'Create the Excel spreadsheet

    Set excelFile = CreateObject("Excel.Application")

    excelFile.Visible = true

    'Create the WorkBook

    Set WorkBook = excelFile.WorkBooks.Add

    'Create the Sheet

    Set Sheet = WorkBook.WorkSheets(1)

    'Get the chart we want to export

    Set tableToExport = ActiveDocument.GetSheetObject("CH04")

    Set chartProperties = tableToExport.GetProperties

    tableToExport.CopyTableToClipboard true

 

    'Get the caption

    chartCaption = tableToExport.GetCaption.Name.v

    'MsgBox chartCaption

    'Set the first cell with the caption

    Sheet.Range("A1") = chartCaption

    'Paste the rest of the chart

    Sheet.Paste Sheet.Range("A2")

    excelFile.Visible = true

    'Save the file and quit excel

    WorkBook.SaveAs filePath

    WorkBook.Close

    excelFile.Quit

    'Cleanup

    Set WorkBook = nothing

    Set excelFile = nothing

End Sub

Anonymous
Not applicable
Author

Hi

I am getting empty excel sheet. can you guide me how to get into excel

Anonymous
Not applicable
Author

i tried below logic

Sub ExcelExport 

    'Set the path where the excel will be saved 

    filePath = "\C:\Developer\Qlikview\Data.xlsx" 

 

 

    'Create the Excel spreadsheet 

    Set excelFile = CreateObject("Excel.Application") 

    excelFile.Visible = true 

    'Create the WorkBook 

    Set WorkBook = excelFile.WorkBooks.Add 

    'Create the Sheet 

    Set Sheet = WorkBook.WorkSheets(1) 

 

 

    'Get the chart we want to export 

    Set tableToExport = ActiveDocument.GetSheetObject("CH02") 

    Set chartProperties = StrighttableToExport.GetProperties 

    StrighttableToExport.CopyTableToClipboard true 

   

 

    'Get the caption 

    chartCaption = tableToExport.GetCaption.Name.v 

    'MsgBox chartCaption 

 

 

    'Set the first cell with the caption 

    Sheet.Range("CH02") = chartCaption 

    'Paste the rest of the chart 

    Sheet.Paste Sheet.Range("CH02") 

    excelFile.Visible = true 

 

 

    'Save the file and quit excel 

    WorkBook.SaveAs filePath 

    WorkBook.Close 

    excelFile.Quit 

 

    'Cleanup 

    Set WorkBook = nothing 

    Set excelFile = nothing 

 

End Sub 

sasikanth
Master
Master

Code working as expected don`t know what exactly the issue is,

please share you application

Anonymous
Not applicable
Author

Hi,

Thank you so much!!!!

It's working good .

Thanks