# TableData to Excel

**URL:** <https://forum.inductiveautomation.com/t/tabledata-to-excel/93779>\
**Category:** Ignition\
**Tags:** python, database, ignition81, scripting, perspective\
**Created:** [July 26, 2024, 8:19am UTC](https://forum.inductiveautomation.com/t/tabledata-to-excel/93779 "2024-07-26T08:19:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Emanuel\_Danielczyk](https://avatars.discourse-cdn.com/v4/letter/e/4da419/32.png) [@Emanuel\_Danielczyk](https://forum.inductiveautomation.com/u/Emanuel_Danielczyk)\
**Post date:** [July 26, 2024, 8:19am UTC](https://forum.inductiveautomation.com/t/tabledata-to-excel/93779/1 "2024-07-26T08:19:17Z")

</div>

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**
>
> ```python
> 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!

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [July 26, 2024, 11:32am UTC](https://forum.inductiveautomation.com/t/tabledata-to-excel/93779/2 "2024-07-26T11:32:03Z")

</div>

exportExcel is vision only

For perspective you should use toExcel

> **[system.dataset.toExcel | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-dataset/system-dataset-toExcel)**
>
> Formats the contents of one or more datasets as an Excel spreadsheet, returning the results as a byte array.

And yes, the download will take place in the browser

---

<div class="post-metadata">

**Author:** ![Alejandro\_Alaco](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/alejandro_alaco/32/59849_2.png) [@Alejandro\_Alaco](https://forum.inductiveautomation.com/u/Alejandro_Alaco)\
**Post date:** [July 26, 2024, 11:39am UTC](https://forum.inductiveautomation.com/t/tabledata-to-excel/93779/3 "2024-07-26T11:39:59Z")

</div>

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

```python
def runAction(self, event):

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

```

---

<div class="post-metadata">

**Author:** ![Emanuel\_Danielczyk](https://avatars.discourse-cdn.com/v4/letter/e/4da419/32.png) [@Emanuel\_Danielczyk](https://forum.inductiveautomation.com/u/Emanuel_Danielczyk)\
**Post date:** [August 12, 2024, 7:46am UTC](https://forum.inductiveautomation.com/t/tabledata-to-excel/93779/4 "2024-08-12T07:46:00Z")

</div>

It works, thanks!
