.xlsm MIME type
Macro-enabled Excel workbookdocuments
application/vnd.ms-excel.sheet.macroEnabled.12Excel workbooks that can contain VBA macros, with the same ZIP-of-XML structure as .xlsx.
| MIME type | application/vnd.ms-excel.sheet.macroEnabled.12 |
|---|---|
| Extensions | .xlsm |
| Content-Type | application/vnd.ms-excel.sheet.macroEnabled.12 |
| Compress in transit? | No — already compressed |
| File signature | 50 4B 03 04 (PK..) the ZIP signature — this format is a ZIP archive inside |
Good to know
- Office blocks macros in files downloaded from the internet by default, so users see the workbook with its macros disabled until they unblock it.
- If you generate spreadsheets for download, produce
.xlsx— there's no reason to ship a macro-enabled type without macros. - Apache's stock config spells the type in lowercase (
macroenabled). Compare MIME types case-insensitively.
Serve .xlsm files with the right type
The response header to send:
Content-Type: application/vnd.ms-excel.sheet.macroEnabled.12
Most servers pick the type from the file extension. If yours sends the wrong one, map it explicitly:
application/vnd.ms-excel.sheet.macroEnabled.12 xlsm;
AddType application/vnd.ms-excel.sheet.macroEnabled.12 .xlsm
res.set("Content-Type", "application/vnd.ms-excel.sheet.macroEnabled.12");import mimetypes
mimetypes.add_type("application/vnd.ms-excel.sheet.macroEnabled.12", ".xlsm")<input type="file" accept=".xlsm,application/vnd.ms-excel.sheet.macroEnabled.12">
Check it
See what a server sends for a file, and what type a local file really is by its contents:
curl -sI https://example.com/file.xlsm | grep -i '^content-type:' file --mime-type file.xlsm
Frequently asked questions
What is the MIME type for .xlsm files?
application/vnd.ms-excel.sheet.macroEnabled.12.
What Content-Type header should a .xlsm file be served with?
Content-Type: application/vnd.ms-excel.sheet.macroEnabled.12. It's already compressed, so servers shouldn't gzip it.
How can I tell if a file is really a .xlsm?
Check its bytes rather than the extension: XLSM files start with 50 4B 03 04 (PK..) — the ZIP signature — this format is a ZIP archive inside. On the command line, file --mime-type name.xlsm does this for you.
Headers that go with it: Content-Type · Content-Disposition · X-Content-Type-Options