What is MIME Type for Excel Document ?


👤 Diwas Poudel    🕒 Mar 12 2022    📁 Fix    📜 0 comment

MIME (Multipurpose Internet Mail Extensions) is a media type used to identify a type of data on the Internet or by applications. Its name contains the word "Internet" but it is not only limited to the Internet.IANA is in charge of standardizing and disseminating these MIME classifications.

There are numerous popular extensions available among them. One of them is the Excel MIME type.

Every mime type is divided into two parts, which are separated by a slash (/).

1 Type is a logical grouping of many MIME types that are similar to one another. All Excel files have an application as a type.

2 SubType is specific to a single file type within the "type".They are unique within the "type".Some of the subtypes for excel files are: vnd.ms-excel,vnd.openxmlformats-officedocument.spreadsheetml.sheet,vnd.openxmlformats-officedocument.spreadsheetml.template,vnd.ms-excel.sheet.macroEnabled.12 etc.

There are various MIME types for Excel for various Excel-related files and their extensions such as. xls,.xlsx,.xlt,.xla, and so on.

Let's look at Excel file MIME Type and extension used by them in table format.

Extension  MIME Type (Type / SubType) Kind of Document
.xls application/vnd.ms-excel  Microsoft Excel   
.xlsx application/vnd.openxmlformats-officedocument.spreadsheetml.sheet  Microsoft Excel (OpenXML) 
.xltx  application/vnd.openxmlformats-officedocument.spreadsheetml.template Office Excel 2007 template
.xlsm application/vnd.ms-excel.sheet.macroEnabled.12  Office Excel 2007 macro-enabled workbook
.xltm application/vnd.ms-excel.template.macroEnabled.12 Office Excel 2007 macro-enabled workbook template
.xlam application/vnd.ms-excel.addin.macroEnabled.12 Office Excel 2007 macro-enabled add-in
.xlsb application/vnd.ms-excel.sheet.binary.macroEnabled.12 Office Excel 2007 non xml binary workbook
various-format-of-excel-file
fig. various format for saving excel file

Let's explain them in brief.

1 .xls

.xls is one of the older file extension of Microsoft Excel Spreadsheet.It is created by Excel 97 or Excel 2003. They by default generate .xls format.

MIME Type Supported by .xls file is application/vnd.ms-excel where the application of MIME type and vnd.ms-excel is subtypes and vnd here means vendor-specific which in this case vendor is Microsoft.

If you have an.xls file and want to open it in Excel before prior 2007, you can do so easily because Excel before 2007 recognizes application/vnd.ms-excel and does not require to afford to open it.

Despite the fact that the.xls file format is older, it can be opened in all versions of Excel due to backward compatibility in newer versions.

2 .xlsx

xlsx is the new file extension of the Microsoft Excel Spreadsheet. It is created by Excel 2007 and later versions.

If you create an excel file in Excel 2007 or later, it will be saved with the.xlsx extension by default; however, you can also save the same file in.xls format.xlsx is more secure and better for data storage(ie. smaller file size) than xls.

MIME type for .xlsx file is application/vnd.openxmlformats-officedocument.spreadsheetml.sheet where MIME type is application and subtype is vnd.openxmlformats-officedocument.spreadsheetml.sheet

It is a file format based on Office OPEN XML developed by Microsoft for representing spreadsheets. Because xlsx is an open standard, other software application vendors, such as Google (Google Sheets), can use it to interoperate with their spreadsheet applications.

📑 The last "x" in the xlsx file extension indicates that the file is based on the XML Standard.

You can open Xls file in excel 2007 and later and convert them to xlsx and save it.

3 .xltx 

Microsoft Excel Template files with the. xltx extensions are based on the Office OpenXML file format specifications. It is used to generate a standard template file that can be used to generate XLSX files with the same settings as the XLTX file.

MIME type for .xlsx file is application/vnd.openxmlformats-officedocument.spreadsheetml.template where MIME type is application and subtype is vnd.openxmlformats-officedocument.spreadsheetml.sheet

It is XML based file format developed by Microsoft for representing templates. An XLTX is identical to an XLSX in every way except that Excel creates a new instance of an XLSX if the file opened is an XLTX.

📓 xltx is the replacement for the old .xlt format.

4  .xlsm

An XLSM file is a macro-enabled spreadsheet created by Microsoft Excel that can also be opened with Google Sheets.XLSM files are based on the Office Open XML format, where the last "m" of an xlsm file extension indicates that the file contains macros.Macros can be stored within an xlsm file, allowing users to automate repetitive tasks.

MIME type for .xlsx file is application/vnd.ms-excel.sheet.macroEnabled.12 where MIME type is application and subtype is vnd.ms-excel.sheet.macroEnabled.12

5  .xlam

An XLAM file extension indicates an Excel Macro-Enabled Add-In file, which is used to provide additional functionality for spreadsheets.
It has the following MIME types:application/vnd.ms-excel.template.macroEnabled.12 where MIME type is application and subtype is vnd.ms-excel.template.macroEnabled.12

Because of the file's purpose, there is built-in macro support in .xlam files.

6 .xlsb

An XLSB file is an Excel Binary Workbook file that stores data in binary rather than XML format. Because they are stored in binary, the read and write times in xlsb files are faster, and they have been found to be useful for very large and complex spreadsheets for this reason. They are also smaller in size than the XLSM format.

MIME type for .xlsx file is application/vnd.ms-excel.sheet.binary.macroEnabled.12 where MIME type is application and subtype is vnd.ms-excel.sheet.binary.macroEnabled.12

FAQ:

How to generate .xls file in C# ?

For generating a .xls file in C# code you have to mention application/vnd.ms-excel MIME types in response header as shown below.

Response.ContentType = "application/vnd.ms-excel";
Response.AppendHeader("content-disposition", "attachment; filename=sample.xls");
How to generate .xlsx file in C#?

For generating a .xls file in C# code you have to mention application/vnd.openxmlformats-officedocument.spreadsheetml.sheet MIME types in response header as shown below.

Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
Response.AppendHeader("content-disposition", "attachment; filename=sample.xls");

If you are generating Excel file target to xlsx file then you have to use above.

What is the replacement of the xla format?

Ans: xlam is the replacement for the old .xla format.