Home » excel » xml – warning when opening generated xls file in excel 2007

xml – warning when opening generated xls file in excel 2007

Posted by: admin March 9, 2020 Leave a comment


I get this warning when opening an XML file with the ending .xls but I want to use it as xls:


How to solve this?

i use .xls with this sourcecode:

<?xml version="1.0" encoding="utf-8"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40">
<Worksheet ss:Name="Export">

<Cell><Data ss:Type="Number">3</Data></Cell>

<Cell><Data ss:Type="Number">22123497</Data></Cell>

How to&Answers:

Well as the commenters already mentionend your example-document is definitly not an xls-file (as those are binary) and Excel rightly complains to that fact (because a document might trick you with the wrong extension).

What you should do is to save the document with file extension xml and add the processing-instruction for an office document (or in this case SpreadsheetML as oposed to the original binary/ propriatary excel-format)

<?xml version="1.0"?>
   <?mso-application progid="Excel.Sheet"?>
   <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"

This used to work, but I just noticed that with Office 2007 the XML-processing component (“XML Editor”) doesn’t seem to be installed as default app for XML files. This did send XML-files to the correct application when they were opened (according to the processiong instuction). Maybe on your machine this works as it was intended to work (otherwise you might have to change this behaviour).

So this is basically the same the other commenters already said. Still I hope this helps.