TableData to Excel

Hello everyone, can someone help me out? I have a table where I generate data from the database, and the data is displayed in the table, so that part works. Now I want to download the table to Excel and have used this code:

code
def runAction(self, event):
	system.perspective.print('Start')
	
	data = self.getSibling("Messwertliste").props.data
	system.perspective.print(data)
	
	ExcelData = system.dataset.exportExcel("filename.xlsx", true, data)
	system.perspective.download("filename.xlsx",ExcelData)
	system.perspective.print('Done')

I printed the data to see if everything is in order, and it fits. However, I don't get to the final print 'done'. I've tried it once with system.perspective.download("filename.xlsx",ExcelData) and without, but neither works. And will the download take place through my browser? Thanks in advance!

exportExcel is vision only

For perspective you should use toExcel

And yes, the download will take place in the browser

1 Like

Hi! I use this code to download my tables on excel .csv format:

def runAction(self, event):

	
	component = self.getSibling("CO2Table")
	
	csv = system.dataset.toCSV(component.props.data)	
	
	system.perspective.download("myExport.csv", csv)
1 Like

It works, thanks!

1 Like