XLSM files are macro-enabled Excel workbooks. When you search for an XLSM to PDF converter, you're looking for one of two things:
1. A tool that converts the visible spreadsheet to PDF — formatting, data, and charts intact 2. A tool that also preserves or extracts the VBA macro code embedded in the file
The answer you get depends entirely on which tool you use. Most converters handle case 1 reliably. Almost none handle case 2.
This roundup covers seven XLSM-to-PDF conversion options, ranked by what matters most: output quality, macro handling, batch capability, and real pricing. We tested each tool on XLSM files with standard layouts, complex formatting, and embedded VBA modules.
| Rank | Tool | Best For | Macro Handling | Price | |------|------|----------|---------------|-------| | 1 | Microsoft Excel (Windows, Save As PDF) | Desktop users with Office | Visible data preserved; VBA not in PDF | Included with Office | | 2 | Aspose.Cells library | Developers needing VBA source extraction | Source extractable before conversion | $1,499/developer | | 3 | LibreOffice + oletools | Self-hosted/open-source builders | Partial extraction via binary parse | Free | | 4 | Adobe Acrobat Pro | Quality rendering + PDF workflow | No — macros dropped | $19.99/month | | 5 | CloudConvert API | Automated batch conversion | No — macros dropped | $9/500 credits | | 6 | ILovePDF | Free, casual use | No — macros dropped | Free / $4/month | | 7 | Smallpdf | Privacy-sensitive documents | No — macros dropped | $12/month |
Before picking a tool, answer this:
Do you need the VBA code after conversion?
If yes: the spreadsheet's automation logic must be preserved alongside or within the conversion output. Only tools 1-3 can do this (with caveats for each).
If no: you need a static PDF of the spreadsheet's visible content — data, formatting, charts. All seven tools on this list handle this. The differences are rendering quality, batch capability, and price.
What it does: Uses Excel's own rendering engine to produce a PDF of the current workbook's visible content.
How to use it:
What happens to macros: VBA code is not transferred to the PDF. PDF is not a format that supports executable macro code. However, the original XLSM file remains unchanged — the macros still exist there. The PDF is a static snapshot of the visible output.
Batch processing:
.bas filesimport win32com.client
import os
excel = win32com.client.Dispatch("Excel.Application")
excel.Visible = False
for filename in os.listdir(r"C:\xlsm_files"):
if filename.endswith(".xlsm"):
wb = excel.Workbooks.Open(rf"C:\xlsm_files\{filename}")
# Export VBA source alongside the PDF
for component in wb.VBProject.VBComponents:
if component.Type in [1, 2, 3]:
component.Export(rf"C:\vba_backup\{component.Name}.bas")
# Save PDF
pdf_path = rf"C:\pdf_output\{filename[:-5]}.pdf"
wb.ExportAsFixedFormat(0, pdf_path)
wb.Close(False)
excel.Quit()
Limitations: Windows only. Requires a licensed Microsoft Office installation. Does not scale to cloud/server deployments without significant infrastructure (Windows VMs, Office licenses per machine).
Best for: Desktop power users on Windows who already have Office, and developers building internal tools on Windows infrastructure.
What it does: A commercial library that parses XLSM files using its own format implementation (no Office or LibreOffice dependency). Converts to PDF while providing programmatic access to VBA project contents.
VBA handling:
Workbook workbook = new Workbook("report.xlsm");
VbaProject vba = workbook.VbaProject;
// Export all modules before PDF conversion
foreach (VbaModule module in vba.Modules)
{
File.WriteAllText($"backup/{module.Name}.bas", module.Codes);
}
// Generate PDF of visible content
workbook.Save("report.pdf", SaveFormat.Pdf);
Output quality: High. Aspose implements its own Excel format renderer and produces accurate PDFs for the vast majority of XLSM files. Complex conditional formatting, named ranges, and pivot tables all render correctly.
Batch processing: Library-native — call in a loop, fully parallel, no subprocess overhead.
Limitations: $1,499/developer license. Python integration via Java bridge adds JVM dependency. Macro execution not supported.
Best for: Developers building a commercial product where VBA source preservation is a paid feature. The license cost amortises across thousands of conversions.
What it does: LibreOffice converts the XLSM to PDF via headless mode. A separate step uses oletools to parse the VBA binary embedded in the XLSM and export module source to text files.
Step 1: Convert to PDF
libreoffice --headless --convert-to pdf report.xlsm --outdir output/
Step 2: Extract VBA source from the original XLSM
python3 -m olevba report.xlsm --source > vba_source.txt
VBA handling: Partial. olevba parses the VBA binary format and extracts readable source for most standard modules. P-code-only modules (where source was removed), password-protected VBA projects, and some ActiveX forms may not parse correctly.
Output quality: Good for standard XLSM files. LibreOffice rendering has known gaps with complex Excel-specific formatting: certain chart types, complex conditional formats, and custom fonts not installed on the server may look different from the Excel-native output.
Batch processing: Fully scriptable. Both LibreOffice and olevba accept file paths as arguments. Python subprocess calls handle parallelization.
Cost: Free. Server infrastructure is the only cost.
Best for: Developers building open-source tools, self-hosted solutions, or MVPs where the goal is to validate demand before committing to a paid library.
What it does: On Windows with Office installed, Acrobat uses Excel's rendering engine to produce high-quality PDFs. On other platforms, Acrobat uses its own renderer.
VBA handling: None. Macros are dropped. The PDF contains only visible content.
Output quality: Excellent on Windows/Office. Acceptable on macOS or without Office (Adobe's own renderer, less accurate for complex formatting).
Batch processing: Action Wizard (Pro) handles folder-level batch jobs without coding. Adobe PDF Services API ($0.05/document) for automated integration.
Cost: $19.99/month (Pro). API: $0.05/document.
Best for: Knowledge workers who need high-quality PDF output and are already in the Adobe ecosystem. Not the right choice for high-volume automated conversion due to per-document API pricing.
What it does: Developer-focused REST API that converts XLSM to PDF via LibreOffice headless on their servers.
VBA handling: None. Same LibreOffice engine as tool #3, without the oletools extraction step. Macros are silently dropped.
Output quality: Good for standard XLSM content. LibreOffice rendering limitations apply.
Batch processing: Full API with parallel job submission, webhooks, and S3 integration. The best batch API in the consumer tier.
Cost: $9/500 credits (pay-as-you-go). 1,000 XLSM-to-PDF conversions ≈ $3.60 at average file sizes. Subscription from $15.20/month for 1,000 credits.
Best for: Developers who need automated XLSM-to-PDF conversion at volume, macros are not a requirement, and rendering quality matches the LibreOffice baseline.
What it does: Consumer web tool for Office and PDF conversions. Upload XLSM, receive PDF. No technical setup required.
VBA handling: None. LibreOffice-based. Macros dropped.
Output quality: Good for straightforward XLSM files. Complex formatting may not render identically.
Batch processing: Available on paid plans ($4/month Basic). Drag and drop multiple files in one session.
Cost: Free tier (unlimited conversions with ads, 100MB max) or $4/month Basic.
Best for: Non-technical users who need to convert one or a few XLSM files to PDF occasionally, macros are not relevant to the output, and they don't want to pay.
What it does: Swiss-based consumer PDF tool. Converts XLSM to PDF with strong privacy guarantees (1-hour file deletion on free tier, Swiss servers).
VBA handling: None. LibreOffice rendering, macros dropped.
Output quality: Comparable to ILovePDF. Good for standard files.
Batch processing: Pro plan ($12/month) enables batch uploads.
Cost: Free (2 tasks/day, 5MB limit) or $12/month Pro.
Best for: Non-technical users converting documents with sensitive content (financial models, confidential reports) where Swiss jurisdiction and 1-hour deletion matter. Not the right choice if VBA content is part of the deliverable.
Seven tools. Seven different architectures. One shared limitation: none of them produce a PDF that contains functional macro code — because PDF is not a format that supports executable VBA.
The real question is whether the VBA code is preserved as a separate artifact alongside the PDF output. Only tools #1, #2, and #3 can do this. The consumer SaaS tools (4-7) do not preserve macro source because it's not in their design brief — their users are converting invoices and reports, not automation infrastructure.
For Excel files where the VBA is the product — a pricing model, an inventory calculator, a payroll processor — the standard converter market doesn't serve the actual need. The Macro-Safe Converter Research Kit documents the competitive gap in this space: who is searching for "xlsm converter keep macros," what the keyword volumes look like, which SERP positions are weak, and how to build a conversion product that serves this underserved market.
I just need XLSM to PDF, macros don't matter: Use ILovePDF (free, unlimited). CloudConvert API if you need automation. Adobe Acrobat if you're on Windows and rendering quality is critical.
I need the VBA source code alongside the PDF: Use LibreOffice + oletools (free, requires Python) or Aspose.Cells (paid, better VBA API). Excel COM automation on Windows is also viable for desktop/internal use.
I'm building a product that converts XLSM files: CloudConvert API for the macro-free tier. Aspose.Cells or LibreOffice + oletools for the macro-aware tier. Price the macro-aware tier higher to recover library costs.
I'm researching this market: The Macro-Safe Converter Research Kit has the competitive analysis, keyword matrix, and implementation architecture for building a converter that solves the problem this entire list has.
Can any online tool convert XLSM to PDF and keep macros? No online consumer tool currently preserves VBA macros when converting XLSM to PDF. PDF is not a format that supports executable code. The VBA project can be extracted alongside the PDF conversion using Aspose.Cells or oletools, but this requires a technical implementation — no click-and-go SaaS provides this.
What is the difference between XLSM and XLSX for PDF conversion?
XLSM is a macro-enabled Excel workbook — structurally identical to XLSX (both are ZIP containers with XML) but includes an additional vbaProject.bin file containing VBA code. When converting to PDF, both formats produce the same output: a static PDF of the visible spreadsheet content. The difference is that XLSM source files contain automation code that XLSX files do not.
Why does my XLSM look different after conversion to PDF? Most converters (CloudConvert, Smallpdf, ILovePDF) use LibreOffice headless, which may render some Excel formatting differently from the Microsoft engine: certain conditional formatting rules, chart styles, and custom fonts may not match exactly. Adobe Acrobat on Windows with Office installed avoids this by using Excel's own rendering engine.
Is there a free way to batch-convert XLSM to PDF?
LibreOffice headless is free and supports batch conversion via command line: libreoffice --headless --convert-to pdf *.xlsm --outdir output/. ILovePDF's free tier allows batch upload for a limited number of files. CloudConvert's free tier provides 25 conversions/day.
What happens to password-protected XLSM files during conversion? Password-protected XLSM files require the password to be provided before conversion. Most online converters fail silently on password-protected files or return an error. Aspose.Cells and LibreOffice can accept passwords via API parameter when the password is known.
Macro-Safe Converter preserves VBA macros through XLSM conversions. One-time kit — no subscription.
Get the Kit — $9 one-time →