# exportExcel file format and extension don't match

**URL:** <https://forum.inductiveautomation.com/t/exportexcel-file-format-and-extension-dont-match/29694>\
**Category:** Ignition\
**Created:** [November 5, 2019, 7:38pm UTC](https://forum.inductiveautomation.com/t/exportexcel-file-format-and-extension-dont-match/29694 "2019-11-05T19:38:33Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![michael.ruel](https://avatars.discourse-cdn.com/v4/letter/m/ecd19e/32.png) [@michael.ruel](https://forum.inductiveautomation.com/u/michael.ruel)\
**Post date:** [November 5, 2019, 7:38pm UTC](https://forum.inductiveautomation.com/t/exportexcel-file-format-and-extension-dont-match/29694/1 "2019-11-05T19:38:33Z")

</div>

I am using the exportExcel function and it works fine, however when I try to open the Excel file I get the following.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/3/31f8baa784188b5d2f328ed88d3dc2f20eed35c7.png) File format and extension of ‘Filename’ don’t match. The file could be corrupted etc…

I have tried a suggested name with extension .xlsx and xls and no extension with all ending in the same result. Does anyone know what format ignition is writing the file as? Is there a way to work around this? I’m using ignition 7.8.5

---

<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:** [November 5, 2019, 8:09pm UTC](https://forum.inductiveautomation.com/t/exportexcel-file-format-and-extension-dont-match/29694/2 "2019-11-05T20:09:48Z")

</div>

> [@michael.ruel](#):
>
> Does anyone know what format ignition is writing the file as?

It's an xml file That Excel can read into a worksheet.

> [@michael.ruel](#):
>
> Is there a way to work around this?

Not as such, but you can take a look at this post:

> [@Exporting to Excel](http://forum.inductiveautomation.com/t/exporting-to-excel/16134):
>
> Hello, Maybe this can help. We were working a few days with this and it’s more related with Microsoft especification than Ignition. If you use the ignition function to export to excel (system.db…Excel) and use the xls extention, excel will raise a message argueing problems with the extension. You can solve this saving with XML extention. But in windows, excel doesn’t know that this xml file is an excel file. To solve this we add the following tag in the beggining of the file: \<?mso-applicati…

---

<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:** [November 5, 2019, 8:24pm UTC](https://forum.inductiveautomation.com/t/exportexcel-file-format-and-extension-dont-match/29694/3 "2019-11-05T20:24:26Z")

</div>

We are looking to finally get proper exporting to “real” XLSX files working - hopefully pretty soon.

---

<div class="post-metadata">

**Author:** ![michael.ruel](https://avatars.discourse-cdn.com/v4/letter/m/ecd19e/32.png) [@michael.ruel](https://forum.inductiveautomation.com/u/michael.ruel)\
**Post date:** [November 6, 2019, 3:14pm UTC](https://forum.inductiveautomation.com/t/exportexcel-file-format-and-extension-dont-match/29694/4 "2019-11-06T15:14:13Z")

</div>

Thanks. I ended up using the dataSetToExcel instead of the exportExcel function which gives the same error but actually opens the excel file. How do I add the Tag suggested in the post? I get a no viable input ? when I try to add it to the beginning of the filename.

TableData = event.source.parent.getComponent(‘tblSerials’).data

#data = system.dataset.toDataSet(TableData)

filePath = system.dataset.dataSetToExcel(1,[TableData])  
filename = system.file.saveFile(“LogEvents\_”+event.source.parent.getComponent(‘TxtField\_Serial Number’).text+".xls")

if filename != None:  
system.file.writeFile(\<?mso-application progid="Excel.Sheet"?\>+filename, filePath)

---

<div class="post-metadata">

**Author:** ![paulm1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paulm1/32/5900_2.png) [@paulm1](https://forum.inductiveautomation.com/u/paulm1)\
**Post date:** [January 5, 2021, 4:30pm UTC](https://forum.inductiveautomation.com/t/exportexcel-file-format-and-extension-dont-match/29694/5 "2021-01-05T16:30:43Z")

</div>

Has this issue been resolved?

---

<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:** [January 5, 2021, 4:43pm UTC](https://forum.inductiveautomation.com/t/exportexcel-file-format-and-extension-dont-match/29694/6 "2021-01-05T16:43:56Z")

</div>

I believe the last bug fixes were as of 8.0.10.

---

<div class="post-metadata">

**Author:** ![n099y](https://avatars.discourse-cdn.com/v4/letter/n/258eb7/32.png) [@n099y](https://forum.inductiveautomation.com/u/n099y)\
**Post date:** [December 14, 2022, 10:06pm UTC](https://forum.inductiveautomation.com/t/exportexcel-file-format-and-extension-dont-match/29694/7 "2022-12-14T22:06:15Z")

</div>

Still a prob currently in last build.

---

<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:** [December 14, 2022, 10:13pm UTC](https://forum.inductiveautomation.com/t/exportexcel-file-format-and-extension-dont-match/29694/8 "2022-12-14T22:13:35Z")

</div>

_What_ issue, exactly?

`system.dataset.exportExcel`, the subject of this post, was overhauled in 8.0.7 (at the same time as we introduced `system.dataset.toExcel`) to properly return a well formatted **XLSX** document. Are you writing the file with an **XLS** extension?

---

<div class="post-metadata">

**Author:** ![n099y](https://avatars.discourse-cdn.com/v4/letter/n/258eb7/32.png) [@n099y](https://forum.inductiveautomation.com/u/n099y)\
**Post date:** [December 14, 2022, 11:13pm UTC](https://forum.inductiveautomation.com/t/exportexcel-file-format-and-extension-dont-match/29694/9 "2022-12-14T23:13:56Z")

</div>

Version: **8.1.21 (b2022092908)**

```auto
table = event.source.parent.getComponent("WMData")
filePath = system.dataset.exportExcel("data.xlsx", 1, table.data)
if filePath != None:
	  system.net.openURL("file://"+filePath)

```

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

---

<div class="post-metadata">

**Author:** ![n099y](https://avatars.discourse-cdn.com/v4/letter/n/258eb7/32.png) [@n099y](https://forum.inductiveautomation.com/u/n099y)\
**Post date:** [December 14, 2022, 11:19pm UTC](https://forum.inductiveautomation.com/t/exportexcel-file-format-and-extension-dont-match/29694/10 "2022-12-14T23:19:42Z")

</div>

The file does open and once opened it will be able to open from that point on without the error. But this happens each time a new file is first downloaded.

---

<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:** [December 15, 2022, 12:28am UTC](https://forum.inductiveautomation.com/t/exportexcel-file-format-and-extension-dont-match/29694/11 "2022-12-15T00:28:16Z")

</div>

Hmm. Obviously, that's not what I expect to be happening. I'm working on reproducing and figuring out what's going wrong.

Does this file do the same?  
[data.xlsx](https://forum.inductiveautomation.com/uploads/short-url/16KCPx7HDCiQIjmSGa9o5V4ekXq.xlsx) (11.2 KB)

Is your Vision module up to date? Does it only happen with the `openURL` call - i.e., if you manually open the file does it still 'alert' you the first time?

---

<div class="post-metadata">

**Author:** ![Elizabeth\_Engler](https://avatars.discourse-cdn.com/v4/letter/e/e9bcb4/32.png) [@Elizabeth\_Engler](https://forum.inductiveautomation.com/u/Elizabeth_Engler)\
**Post date:** [May 20, 2025, 8:36pm UTC](https://forum.inductiveautomation.com/t/exportexcel-file-format-and-extension-dont-match/29694/12 "2025-05-20T20:36:11Z")

</div>

I had the same problem when using system.dataset.toExcel(showHeaders, [data]) and using a .xls extension. **But when I changed it to .xlsx the excel file opens with no error.**

```python
datetimecode = system.date.format(system.date.now(), "yyyyMMdd_HHmm")
filename_prefix = 'ExportedData'
filename = filename_prefix + "_%s.xlsx" % (datetimecode)
	
data = system.dataset.formatDates(dataset, 'MM-dd-yyyy HH:mm:ss')
showHeaders = self.getSibling("Checkbox").props.selected
fb = system.dataset.toExcel(showHeaders, [data])
system.perspective.download(filename, fb)

```

With .xls:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/e/6ec531a2b5175db55ac2cba55bd240b186c895d6.png)

---

<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:** [May 20, 2025, 10:19pm UTC](https://forum.inductiveautomation.com/t/exportexcel-file-format-and-extension-dont-match/29694/13 "2025-05-20T22:19:08Z")

</div>

Yes, that's expected, because since we made a change in the background (described above), we're not longer making a formatted XML file that Excel can be convinced to open as XLS - we're making a "real" **XLSX** file. So the proper file extension for it is `.xlsx`, and if you use the 'wrong' file extension Excel will warn you that something's wrong.

So there's no problem; just use `.xlsx` as your file extension, because that's what it is.
