Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Proper SpreadsheetML file extension

I want to create a a SpreadsheetML file on local drive which can be opened in MS Excel or Open Office by clicking on file in Windows Explorer.

I tried all filename extensions registered to Microsoft Excel i could find so far. Some of them (.xls for example) allows file to be opened, but after "File is in different format than specified by the file extension" warning dialog. Some extensions (like .xlsx) causes Excel to show format error dialog without opening file.

Wikipedia tells that extension should be .xml, but it is registered to be opened by web browser by default.

This, this and this similar questions are about downloading a file from web and setting proper content-type. But i can not change content-type for local file.

This article explains how this annoying Extension Hardening mechanism works and how to disable it, but i think it is wrong to force user to disable security features just to allow spreadsheet file to be opened.

So there is no solution or am i missing something?

like image 976
Vasily Redkin Avatar asked Jul 25 '16 15:07

Vasily Redkin


1 Answers

Now Open Office can open .xlsx (and read) files and Excel can open (and read) .ods files. My suggestion is to pick one of them that best suits your audience and your understanding of the specific file format.

Both of the applications have advantages and disadvanges and non-supported features between the two of them.

I suggest reviewing the document Differences between the OpenDocument Spreadsheet (.ods) format and the Excel (.xlsx) format.

When you work with two file formats, like .xlsx and .ods, there might be formatting differences, and not all features will be available. You’ll be able to convert data and content, but the way you work with the content might be different depending on which formats you use.

One gotcha is with Open Office when you save a .xlsx file it will change the format to a .ods file. Both the applications will re-arrange the folder structure after saving anyway.

The biggest change is how you go about creating the SpreadsheetML files, both Open Office and Excel have a different folder structure depending on the file extension you will use.

Here is a short example of an Excel folder format.

-/
 - _rels/
   - .rels
 - xl/
   - _rels/
     - workbook.xml.rels
   - sheet1.xml
   - workbook.xml
 - [Content_Types].xml

I have created a sample GitHub repository for this with a sample that will open in both Excel and Open Office.

https://github.com/Nico-StackOverflow/proper-spreadsheetml-file-extension

like image 150
Nico Avatar answered Sep 21 '22 23:09

Nico