exportExcel file format and extension don't match

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

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

1 Like

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

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

1 Like

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

1 Like

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)

Has this issue been resolved?

I believe the last bug fixes were as of 8.0.10.

1 Like

Still a prob currently in last build.

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?

Version: 8.1.21 (b2022092908)

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

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.

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 (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?