# Export a dataset/dictionnary to excel and PDF in perspective

**URL:** <https://forum.inductiveautomation.com/t/export-a-dataset-dictionnary-to-excel-and-pdf-in-perspective/44677>\
**Category:** Ignition\
**Created:** [March 19, 2021, 11:01am UTC](https://forum.inductiveautomation.com/t/export-a-dataset-dictionnary-to-excel-and-pdf-in-perspective/44677 "2021-03-19T11:01:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![flavien](https://avatars.discourse-cdn.com/v4/letter/f/f475e1/32.png) [@flavien](https://forum.inductiveautomation.com/u/flavien)\
**Post date:** [March 19, 2021, 11:01am UTC](https://forum.inductiveautomation.com/t/export-a-dataset-dictionnary-to-excel-and-pdf-in-perspective/44677/1 "2021-03-19T11:01:03Z")

</div>

Hi,

The function system.dataset.exportExcel doesn’t work in perspective (in a script button).  
Error message below :

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/5/b595f1a8901ac3d1f8e8ba10c4384d32128f07fa.png)

Do you have a solution ?

Thanks,

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 19, 2021, 6:18pm UTC](https://forum.inductiveautomation.com/t/export-a-dataset-dictionnary-to-excel-and-pdf-in-perspective/44677/2 "2021-03-19T18:18:30Z")

</div>

As in this thread:

> [@\[Feature-13610\]Export to Excel in Perspective Ignition 8](http://forum.inductiveautomation.com/t/feature-13610-export-to-excel-in-perspective-ignition-8/24177/23):
>
> Any chance you would be willing to share your script? I changed to .xlsx and now excel just tells me the file format is not valid. I feel like I must be missing something basic here. This is my code data = self.parent.parent.getChild("Table").props.data headers = data[0].keys() system.perspective.print(headers) datasetData = [] for row in range(len(data)): rowData = [] for col in range(len(headers)): cell = data[row][headers[col]] if hasattr(cell, 'value'): rowData.append(…

Use `system.dataset.toExcel` to transform your dataset into a byte array. Then pass that to `system.perspective.download` to trigger a download request on the local browser.

---

<div class="post-metadata">

**Author:** ![flavien](https://avatars.discourse-cdn.com/v4/letter/f/f475e1/32.png) [@flavien](https://forum.inductiveautomation.com/u/flavien)\
**Post date:** [March 22, 2021, 3:56pm UTC](https://forum.inductiveautomation.com/t/export-a-dataset-dictionnary-to-excel-and-pdf-in-perspective/44677/3 "2021-03-22T15:56:24Z")

</div>

Ok it works.  
Thanks
