devkult_
tools30converters34
home/mime/.xlsm

.xlsm MIME type

Macro-enabled Excel workbookdocuments

application/vnd.ms-excel.sheet.macroEnabled.12

Excel workbooks that can contain VBA macros, with the same ZIP-of-XML structure as .xlsx.

MIME typeapplication/vnd.ms-excel.sheet.macroEnabled.12
Extensions.xlsm
Content-Typeapplication/vnd.ms-excel.sheet.macroEnabled.12
Compress in transit?No — already compressed
File signature50 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:

nginx (inside the types block in mime.types)
application/vnd.ms-excel.sheet.macroEnabled.12 xlsm;
Apache (.htaccess or server config)
AddType application/vnd.ms-excel.sheet.macroEnabled.12 .xlsm
Express
res.set("Content-Type", "application/vnd.ms-excel.sheet.macroEnabled.12");
Python
import mimetypes

mimetypes.add_type("application/vnd.ms-excel.sheet.macroEnabled.12", ".xlsm")
HTML file input
<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.

Related types

Headers that go with it: Content-Type · Content-Disposition · X-Content-Type-Options