XLSM

What is an XLSM file?

An Excel workbook with macros attached.

What XLSM is

XLSM is a container: a wrapper that holds streams encoded by something else. It is used for editing.

The extension is .xlsm, and the full name is Excel Macro-Enabled Workbook. Both matter less than what the file can hold, which is what the rest of this page is about.

Where XLSM came from

Microsoft published it in 2007. The specification is ECMA-376.

Age is worth knowing here for one practical reason: the older a format is, the more programs have had time to learn it.

The specification is public

It is published in full, so anyone can implement it from the document rather than by inspection, which is why it turns up in so many programs and why files written twenty years ago still open. A published specification is not the same thing as a royalty-free one: where a format wraps a codec, the patent licensing is a separate question the standard does not settle.

It can hold several pages in one file

XLSM is not limited to one page, which matters when converting to something that is: one conversion produces one file holding a single page — the first one, unless the page is something the converter lets you pick.

It can contain macros

XLSM is allowed to carry executable code, and that is usually the reason somebody meets this extension at all: a mail gateway or a document portal rejected it. Converting to a format without macros is the usual way past that, and it does mean the macros are gone.

What kind of document it is

XLSM holds a spreadsheet: cells, formulas and the sheets around them.

That is what decides how it converts: a spreadsheet becomes a print area, and a print area is a decision somebody has to make about where the columns break.

What opens XLSM

Microsoft Excel reads it, and so do most programs of the same kind.

If a file will not open, the format is rarely the problem — it is more often that the program predates it. Converting to something older is the reliable way past that, and it is what the rest of this site is for.

Opening it in a browser

No browser reads it.

That is the single most common reason to convert it: not that the format is bad, but that the place you want to show the file cannot read it.

It is a working format

XLSM is meant to be opened and changed. Keep the file in this format for as long as the work is going on, and export from it whenever a finished copy is needed.

The extension is a warning label, deliberately

XLSM and XLSX are the same format. Both are ZIP packages of XML, both hold the same sheets, formulas and formatting, and the only difference is that an XLSM may contain a VBA project and an XLSX may not.

That split was the point. Before 2007 a workbook could carry macros with nothing in the extension to say so, and spreadsheets were one of the most effective malware delivery routes ever used. Separating the extensions means a recipient can see, before opening anything, whether a file claims to contain a VBA project. That is narrower than safe — DDE formulas and embedded OLE objects live in an ordinary XLSX too — but it is the guarantee every intake rule is built on.

What a macro can actually do

VBA is a full programming language with access to the file system, the network and other applications. A macro can read and write files anywhere the user can, send data out, launch programs, and modify other documents. It is not a formula language confined to the sheet.

That is the honest reason for the caution. The overwhelming majority of macros are somebody’s report automation, written by a colleague, doing exactly what it says. The minority that are not have the same capabilities, and the file gives no way to tell them apart short of reading the code.

Why the macros do not run when you open it

Excel disables macros by default and shows a banner. If the file came from the internet or an email attachment, Windows additionally marks it with a zone flag, and since 2022 Excel blocks macros in such files outright — a red banner rather than an enable button.

The intended fix for a file you trust is to unblock it in the file’s properties, or to place it in a folder configured as a trusted location. What is worth resisting is the habit of clicking through: the block exists because that click was the last step in a very large number of real incidents.

Where the code lives, and why it is opaque

The VBA project is stored inside the ZIP as a binary stream — the one part of an Office Open XML package that is not readable XML. Renaming the file to .zip and looking inside shows the sheets in plain text and the macro as an unreadable blob.

So inspecting a macro means opening the VBA editor in Excel or LibreOffice, which most people will not do and which is the only reliable way to know what a workbook does. It also means version control cannot show a meaningful diff of the code, which is why serious spreadsheet automation eventually leaves VBA for something that lives in text files.

Converting to XLSX strips the automation

Saving an XLSM as XLSX removes the VBA project and keeps everything else — sheets, formulas, formatting, charts, named ranges. Excel warns before doing it, and the warning is the whole transaction.

This is exactly what you want for a workbook received from outside that you only need to read the numbers in, and exactly what you do not want for a file whose automation is its purpose. The distinction is simple: if the workbook does something when you press a button, converting breaks it; if it just holds data, converting makes it safer.

And converting to PDF or CSV

PDF for anything being sent, filed or printed. The result is fixed, holds no executable content at all, and removes both the layout question and the macro question in one step. For circulating a report generated by a macro-driven workbook, this is nearly always the right output.

CSV when the target is a database, a script or an analysis pipeline. It carries one sheet of values and nothing else — no formulas, no formatting, no code — which is precisely why import routines and security-conscious systems ask for it by name.

When a workbook has outgrown macros

A VBA project that has become the way a department works is a liability worth naming: the code is opaque to version control, it runs only where Excel runs, it breaks when a sheet is renamed, and it is usually maintained by one person who has since moved on.

Microsoft’s own direction is Office Scripts and Power Automate for that work, and outside the Microsoft world a small script in a language that reads the file directly does the same job in files you can diff. Neither is a reason to rewrite a macro that works. Both are worth knowing before writing a new one that a hundred people will depend on.

The facts, in one place

Identifiers and provenance for the XLSM format.
Extension.xlsm
Media typeapplication/vnd.ms-excel.sheet.macroEnabled.12
Published byMicrosoft
First published2007
SpecificationECMA-376

XLSM files: common questions

What is the difference between XLSM and XLSX?

Only that an XLSM may contain VBA macros and an XLSX may not. The formats are otherwise identical — both are ZIP packages of XML holding the same sheets, formulas and formatting. The separate extension exists so a recipient can see before opening whether the file claims to contain code.

Why are the macros disabled when I open the file?

Excel disables them by default, and since 2022 it blocks them outright in files that came from the internet or an email attachment. For a file you trust, unblock it in the file properties or place it in a trusted location — but the block exists because that click was the last step in many real incidents.

Is it safe to open an XLSM file?

Opening one with macros disabled is as safe as opening an XLSX. Enabling the macros is the decision, and VBA has full access to the file system, the network and other applications. Enable only for files whose origin you actually know.

How do I remove macros from a workbook?

Save it as XLSX. The VBA project is discarded and everything else — sheets, formulas, formatting, charts — is kept. Excel warns first, and that warning is the whole operation.

Can I see what a macro does?

Only by opening the VBA editor in Excel or LibreOffice. The code is stored as a binary stream inside the package, so renaming to .zip shows the sheets as readable XML and the macro as an unreadable blob.

Does LibreOffice run Excel macros?

It opens the file and keeps the data, and it does not run VBA reliably — the two applications use different scripting systems with different object models. Anything beyond simple macros needs rewriting rather than translating.