# .XLSM MIME Type and Content-Type Header

> Excel 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 header: `application/vnd.ms-excel.sheet.macroEnabled.12`
- Compress in transit: no (already compressed)
- File signature: `50 4B 03 04` (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.

## Server configuration

### 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">
```

## FAQ

### 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

- [.xlsx — application/vnd.openxmlformats-officedocument.spreadsheetml.sheet](https://www.devkult.com/mime/xlsx.md)
- [.xls — application/vnd.ms-excel](https://www.devkult.com/mime/xls.md)
- [.docm — application/vnd.ms-word.document.macroEnabled.12](https://www.devkult.com/mime/docm.md)
- [.csv — text/csv](https://www.devkult.com/mime/csv.md)

Open the interactive page: https://www.devkult.com/mime/xlsm