Export Report to Excel

Hello, I am trying to export an information from a report with a Date Range object to excel , the reporting module has a table inside, I tried this code from the manual, but I don’t know the name of the table:

table = event.source.parent.getComponent(“Table”)
filePath = system.dataset.exportExcel(“data.xls”, 1, table.data)
if filePath != None:

With this other code works but return all the data and I have to use a Date Range Object

results = system.db.runQuery("SELECT * FROM example1 ")
results = system.dataset.toDataSet(results)
html = system.dataset.dataSetToHTML(1, results, “Production Report”)
filePath = “C:\output\results.html”
system.file.writeFile(filePath, html)

I did the following and it worked!

table = event.source.parent.getComponent(‘Report Viewer’).Data
filePath = system.dataset.exportExcel(“data.xls”, 1, table)
if filePath != None:

1 Like