# Exporting Perspective Table data to CSV

**URL:** <https://forum.inductiveautomation.com/t/exporting-perspective-table-data-to-csv/89354>\
**Category:** Ignition\
**Tags:** perspective, scripting, ignition81\
**Created:** [April 24, 2024, 12:55pm UTC](https://forum.inductiveautomation.com/t/exporting-perspective-table-data-to-csv/89354 "2024-04-24T12:55:49Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [April 24, 2024, 1:03pm UTC](https://forum.inductiveautomation.com/t/exporting-perspective-table-data-to-csv/89354/3 "2024-04-24T13:03:55Z")

</div>

[system.dataset.toCSV()](https://www.docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-dataset/system-dataset-toCSV#keywords) requires a dataset.

```python
# root > table-flex > body > table
	table = self.getChild("Table Flex").getChild("Body").getChild("Table")
# create a list of columns that are selected by user
	colsToKeep = [col["field"] for col in table.props.columns if col["visible"]]

	data=[]
	for el in table.props.data:
		rowData = [v["value"] for _,v in el.items() if _ in colsToKeep]
		data.append(rowData)
	
	newCsv = system.dataset.toCSV(system.dataset.toDataSet(colsToKeep, data)	
	system.perspective.download("Export.csv",newCsv)

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/exporting-perspective-table-data-to-csv/89354)._
