# \[Feature-13610\]Export to Excel in Perspective Ignition 8

**URL:** <https://forum.inductiveautomation.com/t/feature-13610-export-to-excel-in-perspective-ignition-8/24177>\
**Category:** Ignition Early Access\
**Tags:** ignition80, scripting\
**Created:** [April 16, 2019, 3:23pm UTC](https://forum.inductiveautomation.com/t/feature-13610-export-to-excel-in-perspective-ignition-8/24177 "2019-04-16T15:23:56Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![osolorzano](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/osolorzano/32/6432_2.png) [@osolorzano](https://forum.inductiveautomation.com/u/osolorzano)\
**Post date:** [March 9, 2021, 10:20pm UTC](https://forum.inductiveautomation.com/t/feature-13610-export-to-excel-in-perspective-ignition-8/24177/21 "2021-03-09T22:20:00Z")

</div>

Not 100% sure this is the reason, but if you are on a version 8.0.7 or higher, the `toExcel()` function will export the data as an “xlsx” instead of the older “xls” file type. It may go away if you set the file type to “xlsx”.

---

<div class="post-metadata">

**Author:** ![lwood](https://avatars.discourse-cdn.com/v4/letter/l/977dab/32.png) [@lwood](https://forum.inductiveautomation.com/u/lwood)\
**Post date:** [March 15, 2021, 12:28pm UTC](https://forum.inductiveautomation.com/t/feature-13610-export-to-excel-in-perspective-ignition-8/24177/22 "2021-03-15T12:28:26Z")

</div>

100% what osolorzano said. We had this issue and as soon as we added .xlsx it went away.

---

<div class="post-metadata">

**Author:** ![jd1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jd1/32/18928_2.png) [@jd1](https://forum.inductiveautomation.com/u/jd1)\
**Post date:** [March 15, 2021, 7:55pm UTC](https://forum.inductiveautomation.com/t/feature-13610-export-to-excel-in-perspective-ignition-8/24177/23 "2021-03-15T19:55:26Z")

</div>

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

```auto
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(cell.value)
			else:
				rowData.append(cell)
		#system.perspective.print(rowData)
		datasetData.append(rowData)
	
	#system.perspective.print(datasetData)	
	finalDataset = system.dataset.toDataSet(headers,datasetData)
	XLSFormat = system.dataset.dataSetToExcel(True,[finalDataset])
	system.perspective.download("test.xlsx",XLSFormat)

```

---

<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 15, 2021, 8:02pm UTC](https://forum.inductiveautomation.com/t/feature-13610-export-to-excel-in-perspective-ignition-8/24177/24 "2021-03-15T20:02:14Z")

</div>

`dataSetToExcel` is the ‘legacy’, deprecated implementation. Use [`system.dataset.toExcel`](https://docs.inductiveautomation.com/display/DOC81/system.dataset.toExcel) - it should be a simple swap.

---

<div class="post-metadata">

**Author:** ![jd1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jd1/32/18928_2.png) [@jd1](https://forum.inductiveautomation.com/u/jd1)\
**Post date:** [March 15, 2021, 8:07pm UTC](https://forum.inductiveautomation.com/t/feature-13610-export-to-excel-in-perspective-ignition-8/24177/25 "2021-03-15T20:07:05Z")

</div>

that seems to have fixed my problem. I still have to manually add the “.xlsx” to the end of the file name in the save dialog box. Is there anyway to make that be automatic?

---

<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 15, 2021, 8:55pm UTC](https://forum.inductiveautomation.com/t/feature-13610-export-to-excel-in-perspective-ignition-8/24177/26 "2021-03-15T20:55:48Z")

</div>

No; it’s up to your browser. The most you can provide to a browser is a suggested filename; whether the browser will use that (or parse it for an extension, etc) is out of our hands:  
[https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/download](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/download)

---

<div class="post-metadata">

**Author:** ![jd1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jd1/32/18928_2.png) [@jd1](https://forum.inductiveautomation.com/u/jd1)\
**Post date:** [March 15, 2021, 9:01pm UTC](https://forum.inductiveautomation.com/t/feature-13610-export-to-excel-in-perspective-ignition-8/24177/27 "2021-03-15T21:01:51Z")

</div>

That makes sense. Just for the sake of putting this out there, Google Chrome uses the suggested file name, as does the latest version of Firefox. It was actually perspective workstation that was ignoring it. I’m not sure if that is something within IA’s power to change.

---

<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 15, 2021, 9:28pm UTC](https://forum.inductiveautomation.com/t/feature-13610-export-to-excel-in-perspective-ignition-8/24177/28 "2021-03-15T21:28:49Z")

</div>

> [@jd1](#):
>
> It was actually perspective workstation that was ignoring it. I’m not sure if that is something within IA’s power to change.

Huh, good to know - I let the relevant experts know about it. There might be something we can do to fix that.

---

<div class="post-metadata">

**Author:** ![jay.meinke](https://avatars.discourse-cdn.com/v4/letter/j/ce7236/32.png) [@jay.meinke](https://forum.inductiveautomation.com/u/jay.meinke)\
**Post date:** [April 17, 2021, 10:12pm UTC](https://forum.inductiveautomation.com/t/feature-13610-export-to-excel-in-perspective-ignition-8/24177/29 "2021-04-17T22:12:16Z")

</div>

This works too.

data = self.getSibling(Table).props.data  
data = system.dataset.toExcel(True, [data])  
system.perspective.download(‘filename.xlsx’,data)

---

<div class="post-metadata">

**Author:** ![garnet.tozer](https://avatars.discourse-cdn.com/v4/letter/g/a587f6/32.png) [@garnet.tozer](https://forum.inductiveautomation.com/u/garnet.tozer)\
**Post date:** [June 8, 2021, 11:21pm UTC](https://forum.inductiveautomation.com/t/feature-13610-export-to-excel-in-perspective-ignition-8/24177/30 "2021-06-08T23:21:49Z")

</div>

Nicely done Jay!

---

<div class="post-metadata">

**Author:** ![jramirez3](https://avatars.discourse-cdn.com/v4/letter/j/a183cd/32.png) [@jramirez3](https://forum.inductiveautomation.com/u/jramirez3)\
**Post date:** [June 17, 2021, 8:43pm UTC](https://forum.inductiveautomation.com/t/feature-13610-export-to-excel-in-perspective-ignition-8/24177/31 "2021-06-17T20:43:05Z")

</div>

Is everyone able to view the downloaded Excel file?  
I can get it it download but its always corrupted and Excel won’t let me view it.  
Anyone have any suggestions on what to try?

---

<div class="post-metadata">

**Author:** ![mblystone](https://avatars.discourse-cdn.com/v4/letter/m/9de053/32.png) [@mblystone](https://forum.inductiveautomation.com/u/mblystone)\
**Post date:** [August 9, 2021, 2:25pm UTC](https://forum.inductiveautomation.com/t/feature-13610-export-to-excel-in-perspective-ignition-8/24177/32 "2021-08-09T14:25:07Z")

</div>

You are my hero. Well done.

---

<div class="post-metadata">

**Author:** ![Ryan\_Bein](https://avatars.discourse-cdn.com/v4/letter/r/ecccb3/32.png) [@Ryan\_Bein](https://forum.inductiveautomation.com/u/Ryan_Bein)\
**Post date:** [June 8, 2022, 4:23am UTC](https://forum.inductiveautomation.com/t/feature-13610-export-to-excel-in-perspective-ignition-8/24177/33 "2022-06-08T04:23:44Z")

</div>

Thank you for Sharing. This was a great solution for what I needed.

---

<div class="post-metadata">

**Author:** ![Pierre\_Nerriere](https://avatars.discourse-cdn.com/v4/letter/p/51bf81/32.png) [@Pierre\_Nerriere](https://forum.inductiveautomation.com/u/Pierre_Nerriere)\
**Post date:** [February 19, 2023, 10:37pm UTC](https://forum.inductiveautomation.com/t/feature-13610-export-to-excel-in-perspective-ignition-8/24177/34 "2023-02-19T22:37:17Z")

</div>

```auto
def runAction(self, event):
	table = self.view.custom.data
	excelstr = system.dataset.toExcel(True,[table])
 
	fileName = "VolumeHmeleck %s.xlsx" % system.date.now()
	system.perspective.download(fileName, excelstr)

```

---

<div class="post-metadata">

**Author:** ![Alex\_Wakefield](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@Alex\_Wakefield](https://forum.inductiveautomation.com/u/Alex_Wakefield)\
**Post date:** [June 1, 2023, 1:41pm UTC](https://forum.inductiveautomation.com/t/feature-13610-export-to-excel-in-perspective-ignition-8/24177/35 "2023-06-01T13:41:37Z")

</div>

So I have a question. I have written code that works for this, and in "Preview" mode in the designer works great. Although when I open the application over the web, when I click my button, nothing happens. What would be the cause of this?

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [June 1, 2023, 3:40pm UTC](https://forum.inductiveautomation.com/t/feature-13610-export-to-excel-in-perspective-ignition-8/24177/36 "2023-06-01T15:40:26Z")

</div>

We would need to see your script in order to really help you. The Designer is not a true comparison to a running Session as it has different scopes, permissions, and capabilities available to it as an application, compared to a browser page.

---

<div class="post-metadata">

**Author:** ![samer\_samy](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/samer_samy/32/52910_2.png) [@samer\_samy](https://forum.inductiveautomation.com/u/samer_samy)\
**Post date:** [July 26, 2023, 11:05am UTC](https://forum.inductiveautomation.com/t/feature-13610-export-to-excel-in-perspective-ignition-8/24177/37 "2023-07-26T11:05:37Z")

</div>

> [@craigb](#):
>
> ```auto
> dataset = self.parent.parent.getChild("Table Container").getChild("Your_Table").props.data
> data = system.dataset.toCSV(dataset, 1, 0, 0)
> filename = 'Orders.csv'
> system.perspective.download(filename, data)
> 
> ```

it works ,u r genius

---

<div class="post-metadata">

**Author:** ![samer\_samy](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/samer_samy/32/52910_2.png) [@samer\_samy](https://forum.inductiveautomation.com/u/samer_samy)\
**Post date:** [July 26, 2023, 11:34am UTC](https://forum.inductiveautomation.com/t/feature-13610-export-to-excel-in-perspective-ignition-8/24177/38 "2023-07-26T11:34:03Z")

</div>

your code working also ,thanks . may be my attached pic will help some visitors here

 ![Screenshot 2023-07-26 142804](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/2/7210c04f0d3db6c92cfde55c2d7186908a7b449b.png)

---

<div class="post-metadata">

**Author:** ![pawel.kondol1](https://avatars.discourse-cdn.com/v4/letter/p/54ee81/32.png) [@pawel.kondol1](https://forum.inductiveautomation.com/u/pawel.kondol1)\
**Post date:** [July 27, 2023, 11:08am UTC](https://forum.inductiveautomation.com/t/feature-13610-export-to-excel-in-perspective-ignition-8/24177/39 "2023-07-27T11:08:58Z")

</div>

> [@jay.meinke](#):
>
> data = self.getSibling(Table).props.data  
> data = system.dataset.toExcel(True, [data])  
> system.perspective.download(‘filename.xlsx’,data)

Great Job. This is what I was looking for. Not sure why this is not documented as export files in Ignition.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 1, 2024, 11:46am UTC](https://forum.inductiveautomation.com/t/feature-13610-export-to-excel-in-perspective-ignition-8/24177/40 "2024-07-01T11:46:08Z")

</div>

Split this topic on July 1, 2024, 11:46am UTC

A post was merged into an existing topic: [Download SPC charts as an Excel file](https://forum.inductiveautomation.com/t/download-spc-charts-as-an-excel-file/92612/2)

[Previous page](https://forum.inductiveautomation.com/t/feature-13610-export-to-excel-in-perspective-ignition-8/24177.md?page=1)
