If you're building a product or internal tool that converts Excel files with macros, you've narrowed down to one of two realistic options: Aspose.Cells or LibreOffice headless. Every consumer SaaS (CloudConvert, Zamzar, Smallpdf) uses LibreOffice under the hood and drops macros silently. COM automation via Microsoft Office is Windows-only and doesn't scale to multi-tenant cloud deployments.
That leaves Aspose.Cells — the commercial library that implements VBA access at the API level — and LibreOffice headless — the free, open-source path that handles most conversions well but has known gaps with VBA.
This comparison is for developers and technical founders making an architecture decision, not for end users comparing web tools.
| Dimension | Aspose.Cells | LibreOffice Headless | |---|---|---| | License | Commercial — $1,499/developer | Free — MPL 2.0 | | VBA macro read access | Yes — documented API | No — binary blob, no API | | VBA macro write access | Yes | No | | XLSM to PDF quality | High — own parser, no dependency | Good — own parser, some edge cases | | XLAM add-in support | Yes | Limited | | DOCM support | Yes (Aspose.Words) | Yes | | Concurrent processing | Yes — stateless library, scalable | Yes — headless process, scalable | | Platform | .NET, Java, Python (via Java bridge) | Linux, Windows, macOS | | Execution speed | Fast — pure library, no subprocess | Moderate — subprocess per conversion | | Community / support | Commercial support + extensive docs | Open source, community forums |
Short answer: If VBA code must survive conversion as functional or readable source, Aspose.Cells is the only production-ready cross-platform library. LibreOffice handles the 80% case (standard format conversions) at zero cost, but its VBA handling is a known gap — macros are dropped across format conversions and the binary VBA project is not accessible via any LibreOffice API.
Aspose is a Netherlands-based company that has been building Office file format libraries since 2002. Aspose.Cells handles spreadsheet formats (XLS, XLSX, XLSM, XLAM, XLSB, CSV, ODS, and more); Aspose.Words handles Word documents (DOC, DOCX, DOCM). The core differentiator is their implementation: Aspose writes its own format parsers from the OOXML and BIFF specifications, with no dependency on Microsoft Office, LibreOffice, or any external conversion engine.
Pricing (2026):
// Open an XLSM file
Workbook workbook = new Workbook("report.xlsm");
// Access the VBA project
VbaProject vbaProject = workbook.VbaProject;
// List all modules with their full source code
foreach (VbaModule module in vbaProject.Modules)
{
Console.WriteLine($"Module: {module.Name} | Type: {module.Type}");
Console.WriteLine(module.Codes); // Full VBA source, readable and editable
}
// Modify a module
VbaModule targetModule = vbaProject.Modules["Module1"];
targetModule.Codes = targetModule.Codes.Replace("OldValue", "NewValue");
// Save with macros preserved — output is still a valid XLSM
workbook.Save("report-modified.xlsm", SaveFormat.Xlsm);
This is not extraction — it is structured access to the VBA project tree. Module names, types (standard, class, UserForm), source code, and references are all accessible and modifiable programmatically.
For cross-format conversion (XLSM to PDF):
Workbook workbook = new Workbook("report.xlsm");
// Export VBA modules to separate files before PDF conversion
VbaProject vbaProject = workbook.VbaProject;
foreach (VbaModule module in vbaProject.Modules)
{
File.WriteAllText($"exports/{module.Name}.bas", module.Codes);
}
// Convert visible content to PDF
PdfSaveOptions pdfOptions = new PdfSaveOptions();
workbook.Save("report.pdf", pdfOptions);
// macros.bas files now contain the preserved VBA source
The PDF itself is static (no format can hold executable VBA in a portable way), but the VBA source is extracted in parallel and preserved for re-embedding or archiving.
Limitations:
LibreOffice is the predominant open-source Office suite. The headless mode (libreoffice --headless --convert-to ) runs without a GUI and converts documents from the command line. This is what CloudConvert, Zamzar, Smallpdf, and most conversion SaaS use under the hood for Office-to-PDF.
License: Mozilla Public License 2.0 — free to use, modify, and redistribute in commercial products.
Pricing: Free. Infrastructure is the only cost.
Basic usage:
Convert XLSM to PDF
libreoffice --headless --convert-to pdf report.xlsm --outdir output/
Convert XLSX to CSV
libreoffice --headless --convert-to csv:Text\ -\ txt\ -\ utf8 data.xlsx --outdir output/
Batch convert all XLSX files in a directory
libreoffice --headless --convert-to pdf *.xlsx --outdir output/
Concurrency via subprocess:
LibreOffice headless runs as a subprocess per conversion. For concurrent processing, you spawn multiple LibreOffice instances with a lock directory per instance:
import subprocess
import tempfile
import os
def convert_file(input_path: str, output_dir: str, output_format: str = "pdf") -> str:
with tempfile.TemporaryDirectory() as lockdir:
result = subprocess.run([
"libreoffice",
"--headless",
f"--env:UserInstallation=file://{lockdir}",
"--convert-to", output_format,
input_path,
"--outdir", output_dir
], capture_output=True, timeout=60)
if result.returncode != 0:
raise RuntimeError(f"Conversion failed: {result.stderr.decode()}")
base = os.path.splitext(os.path.basename(input_path))[0]
return os.path.join(output_dir, f"{base}.{output_format}")
VBA handling — the gap:
LibreOffice's internal model does not implement a VBA runtime. When it opens an XLSM file, the VBA project binary (vbaProject.bin) is read as an opaque blob. LibreOffice can preserve this blob in round-trip XLSM→XLSM saves, but:
1. For any cross-format conversion (XLSM to PDF, XLSM to XLSX, XLSM to CSV): the VBA project is not transferred. The output has no macro code. 2. There is no LibreOffice API to access VBA module names, source code, or references. The blob is not parsed into structured data. 3. LibreOffice Basic (the office suite's own macro language) is a different runtime from VBA. XLSM files with VBA do not execute as LibreOffice Basic.
The workaround — oletools extraction:
The XLSM format is a ZIP container. The VBA project binary sits at xl/vbaProject.bin. You can extract and parse this binary outside of LibreOffice:
import zipfile
import subprocess
import os
def extract_vba_source(xlsm_path: str, output_dir: str) -> list[str]:
"""Extract VBA module source code from XLSM without LibreOffice."""
with zipfile.ZipFile(xlsm_path, 'r') as z:
if 'xl/vbaProject.bin' not in z.namelist():
return []
vba_bin = z.read('xl/vbaProject.bin')
bin_path = os.path.join(output_dir, 'vbaProject.bin')
with open(bin_path, 'wb') as f:
f.write(vba_bin)
# Use olevba (from oletools) to parse the binary
result = subprocess.run(
['olevba', '--source', bin_path],
capture_output=True, text=True
)
# Parse output into module files...
return result.stdout
This gives you VBA source code as text. It is not re-embedded into the converted output — it is a separate artifact alongside the converted file. Useful for archiving or audit; not a substitute for true macro preservation.
Limitations:
olevba from the oletools package handles standard VBA binary format. P-code-only modules (where the source was stripped and only compiled bytecode remains), certain macro-locked files, and some ActiveX-heavy workbooks are not reliably parsed.| Requirement | Aspose.Cells | LibreOffice + oletools | |---|---|---| | Read VBA source from XLSM | Yes — API | Partial — binary extraction | | Modify VBA source programmatically | Yes — API | No — text manipulation only | | Save XLSM with original macros intact | Yes | Yes (same-format only) | | Extract VBA before cross-format conversion | Yes — API | Yes — binary extraction | | Handle obfuscated or P-code-only macros | Yes (reads bytecode) | No (fails on P-code) | | Re-embed extracted macros into new XLSM | Yes — API | No |
Assume you're processing 10,000 XLSM files/month:
Both Aspose.Cells and LibreOffice require technical implementation — there is no SaaS equivalent that exposes their capabilities through a simple web interface.
Aspose.Cells' VBA API is powerful but priced for enterprise buyers. LibreOffice's binary extraction approach requires custom code and only handles the 80% case. COM automation (the third option) is Windows-only.
The gap is the same one identified in the CloudConvert vs Zamzar comparison: no consumer-facing product offers reliable macro preservation with drag-and-drop simplicity and SaaS pricing. The Macro-Safe Converter Research Kit documents the architectural path, the competitive keyword data, and the pricing benchmarks for building this product on top of either Aspose.Cells or the LibreOffice + oletools approach.
Choose Aspose.Cells if:
Can LibreOffice preserve Excel macros? In same-format saves (XLSM to XLSM), LibreOffice preserves the VBA project binary as an opaque blob. For cross-format conversions (XLSM to PDF, XLSM to XLSX), the macro code is dropped. There is no LibreOffice API to access or manipulate VBA source code.
Does Aspose.Cells run macros? No. Aspose.Cells reads and writes VBA source code and module structure, but it does not execute VBA. If your workflow requires macros to run during conversion (to trigger calculations, update values, or produce output), you need COM automation driving a real Excel instance.
Is there a free version of Aspose.Cells? Aspose.Cells is available for a free trial with no time limit — the output files include an evaluation watermark. The watermark is removed with a valid license. The full feature set including VBA API is available during the trial.
What is the performance difference between Aspose and LibreOffice at scale? Aspose.Cells runs as a library call within your application process — no subprocess spawning, no startup overhead per conversion. LibreOffice headless spawns a subprocess per conversion job, which adds 1-3 seconds of startup time per file. For batch processing, this compounds significantly. At 1,000 conversions/hour, LibreOffice startup overhead alone adds 17-50 minutes compared to Aspose.
Can I use Aspose.Cells in a SaaS product? The standard developer license covers in-house use. For a SaaS product where end users upload files and your backend processes them using Aspose, you need to contact Aspose sales for OEM/redistribution licensing. Terms and pricing differ from the standard developer license.
See how macro loss plays out in practice — and what recovery actually looks like:
Macro-Safe Converter preserves VBA macros through XLSM conversions. One-time kit — no subscription.
Get the Kit — $9 one-time →