What is the XLSM file format?
.xlsm is a commonly used spreadsheet document created with Excel 2007 or later. .xlsm files store data in cells organized in rows and columns. The format is based on the Office Open XML standard and uses ZIP compression, making it structurally similar to an .xlsx file.
.xlsm and .xlsx are almost identical spreadsheet formats, with the key difference that .xlsm contains macros written in Visual Basic for Applications (VBA). A macro is a user-defined function that can be used to automate repetitive tasks, manipulate data, or drive other Office applications. Macros are disabled in Excel by default for security reasons, as macros are susceptible to being used for malicious code delivery. To use macros, the spreadsheet document must be saved as an .xlsm file; saving as .xlsx silently removes the VBA project.
Internally, the VBA project is stored as a binary xl/vbaProject.bin part inside the ZIP package. The package's [Content_Types].xml declares the macroEnabled.12 content type, which is what distinguishes .xlsm from .xlsx at the format level - both share the same PK magic bytes. A related format is .xltm, the macro-enabled Excel template variant, and .xlsb is the binary equivalent that also supports macros.
Security & safety
RISK: HIGHXLSM is the high-risk member of the Excel family precisely because it CAN run code: its VBA macros are a classic malware vector. The attack pattern is an emailed .xlsm that pressures you to click 'Enable Content/Macros', after which the VBA downloads or executes a payload. Defences: Microsoft blocks macros by default in files that came from the internet (Mark of the Web) and opens untrusted files in Protected View - leave both on. Only enable macros in files you specifically expect from a trusted sender. If you just need the data and not the automation, open it in Google Sheets / Excel for the web (which don't run VBA) or save it as .xlsx to strip the code. Treat any unsolicited 'enable macros' request as hostile.
Format details
in a nutshellPrograms that open XLSM files
Technical details
deep spec| MIME type | application/vnd.ms-excel.sheet.macroEnabled.12 |
| Container format | ZIP-based Office Open XML (OPC) package |
| Magic bytes | 50 4B 03 04 ("PK" - ZIP local file header at offset 0; byte-identical to .xlsx, distinguished only by internal content |
| VBA project part | xl/vbaProject.bin - Compound File Binary (CFB) embedded inside the ZIP package |
| Macro language | Visual Basic for Applications (VBA) |
| Content-type identifier | macroEnabled.12, declared in [Content_Types].xml; this is what formally distinguishes .xlsm from .xlsx |
| Default macro security | Macros blocked on open; execution requires user confirmation via prompt or a configured trusted location |
| VBA code signing | VBA project can be signed with a code-signing certificate to establish publisher trust and suppress prompts |
| Encryption | AES-256 password encryption via Office Open XML protection (available from Excel 2013 onward) |
| Maximum worksheet size | 1,048,576 rows × 16,384 columns per sheet |
| Template counterpart | .xltm - the macro-enabled workbook template format; same internal structure, different extension role |
| Forced extension rule | Excel refuses to save a VBA-containing workbook as .xlsx; the user is prompted to save as .xlsm instead |
| Web and mobile limitation | VBA macros do not execute in Excel for the web or Excel on mobile; macro content is preserved but inactive |
| Third-party VBA support | LibreOffice Calc opens .xlsm with partial VBA compatibility; complex macros or Excel object model calls may behave differently |
| Released | 2007 (Excel 2007); the macro-enabled variant of the ECMA-376 / ISO-IEC 29500 format |
| Open standard | Yes · royalty-free |
| Specification | learn.microsoft.com |
XLSM conversions
Community Q&A
asked by usersNo questions yet - be the first to ask about XLSM files.