Batch Convert .xls Files to .xlsx: PowerShell vs LegacyLeaps

April 9, 2026 · 9 min read

You've got 400 .xls files — or 4,000. Your IT manager wants them migrated to .xlsx before the next Windows upgrade. Someone on the team suggests PowerShell. It's free, it's built-in, and there are scripts on Stack Overflow. What could go wrong?

Quite a bit, actually. PowerShell can convert .xls files to .xlsx — but it does so by automating Excel's COM interface, and that process silently strips VBA macros from any workbook that contains them. For a folder of simple spreadsheets with no automation, it works fine. For a folder of production workbooks with macros, it's a disaster that won't announce itself until someone tries to run a report and nothing happens.

This guide compares the two main approaches for bulk .xls to .xlsx conversion: PowerShell automation and LegacyLeaps. We'll walk through the PowerShell approach, explain exactly where it breaks down, and show what to do instead when macros are involved.

Why Batch .xls Conversion Matters Right Now

The .xls format dates to Excel 97 and uses the BIFF8 binary structure Microsoft officially discontinued. Starting with Windows 11 24H2, Microsoft tightened security policies around legacy binary formats — some organizations have already seen Excel refuse to open .xls files from network drives under Protected View without active user intervention on every file. Our complete guide to legacy Excel migration covers the full picture of what's changing and why.

Beyond compatibility, .xlsx files are typically 25-40% smaller, open faster, and work cleanly with Power Query, Power BI, and SharePoint. If your organization runs Excel 365, the pressure to migrate off .xls is real and increasing.

The PowerShell Approach

PowerShell can automate Excel's COM interface to open and save files in bulk. Here's the standard script you'll find on most IT forums:

# Batch convert .xls to .xlsx using PowerShell + Excel COM
$sourceDir = "C:\LegacyFiles"
$destDir   = "C:\ConvertedFiles"
$xlXml     = 51  # xlOpenXMLWorkbook format constant

$excel = New-Object -ComObject Excel.Application
$excel.Visible = $false
$excel.DisplayAlerts = $false

Get-ChildItem -Path $sourceDir -Filter "*.xls" | ForEach-Object {
    $destPath = Join-Path $destDir ($_.BaseName + ".xlsx")
    $wb = $excel.Workbooks.Open($_.FullName)
    $wb.SaveAs($destPath, $xlXml)
    $wb.Close($false)
    Write-Host "Converted: $($_.Name)"
}

$excel.Quit()
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($excel) | Out-Null

What this script does well

Where PowerShell conversion breaks down

Critical limitation: Format constant 51 (xlOpenXMLWorkbook) saves as .xlsx. The .xlsx format does not support VBA macros. Any macros in the source .xls file are silently dropped during the save. Excel will not warn you. The script reports "Converted: filename.xls" as if everything worked fine.

To preserve macros you'd need format constant 52 (xlOpenXMLWorkbookMacroEnabled), which saves as .xlsm. But .xlsm is not .xlsx — and if your goal is format compliance or SharePoint upload compatibility, .xlsm files often fail those requirements anyway.

Beyond macros, PowerShell/Excel COM has several other failure modes at scale:

Scanning First: The Smart Pre-Migration Step

Before converting anything — PowerShell or otherwise — you need to know what's actually in your files:

If you run PowerShell blind on 400 .xls files and 80 of them contain macros, you've silently broken 80 production workbooks. You may not discover the damage until a month-end report fails or a coworker notices their automation stopped running.

Know what you're working with before you convert

LegacyLeaps scans your entire folder and shows you exactly which files have macros, ActiveX controls, external links, and compatibility issues — before you touch a single file.

Try the Free Scan

The LegacyLeaps Approach to Batch Conversion

LegacyLeaps was built for this exact scenario: large folders of mixed legacy Office files, some simple, some with years of embedded automation, all needing to reach modern format without losing anything.

How it works

  1. Scan phase: LegacyLeaps reads every file in your selected folder (and subfolders) without opening them in Excel. It identifies macro presence, ActiveX controls, external references, named ranges, and format-specific features — typically in under 2 minutes for 1,000 files.
  2. Audit report: Before converting anything, you get a per-file breakdown: which files are safe to convert to .xlsx, which need .xlsm to preserve macros, which have external links that may need manual review.
  3. Conversion: LegacyLeaps converts files in parallel using its native engine — no Excel required. Macro-bearing workbooks are preserved with their VBA intact. Non-macro workbooks convert to clean .xlsx.
  4. Verification report: After conversion, you get a summary showing what was preserved, what changed, and any files needing manual attention.

Speed comparison

File countPowerShell + ExcelLegacyLeaps
100 files5–15 min<1 min
500 files25–75 min3–5 min
1,000 files45–90 min5–10 min
5,000 files4–8 hours25–40 min

Feature comparison

FeaturePowerShell + ExcelLegacyLeaps
VBA macro preservationNo (.xlsx) or saves .xlsmYes — preserved in .xlsm, flagged in report
ActiveX control handlingSilently dropped or brokenAudited; modern equivalents suggested
External link detectionNoYes — listed in scan report
Requires Excel installedYesNo
Parallel processingNoYes
Pre-conversion auditNoYes
Post-conversion reportBasic log onlyFull per-file summary
Files leave your machineNoNo (desktop app)
CostFree (+ your time)Token-based (pay per file converted)

When PowerShell Is the Right Choice

PowerShell batch conversion is genuinely useful when:

A common hybrid workflow: use LegacyLeaps to scan everything and handle the macro-bearing files, then use PowerShell for the simple remainder. This gives you the best of both — automation for the clean files, safe handling for the complex ones.

When LegacyLeaps Is the Right Choice

LegacyLeaps is the right tool when:

Practical Workflow for IT Teams

Here's the approach we recommend for any bulk .xls migration:

  1. Scan first, always. Run LegacyLeaps's free scan against your file set. Get the report: how many files, how many with macros, how many with external dependencies.
  2. Separate your files. Based on the scan, split into two groups: macro-free (safe for any converter) and macro-bearing (need LegacyLeaps or manual handling).
  3. Convert macro-bearing files with LegacyLeaps. These get proper .xlsm output with VBA intact, plus a per-file report of what was preserved.
  4. Convert the rest. Macro-free files can go through PowerShell, LegacyLeaps, or any other tool — they'll convert cleanly either way.
  5. Test before deploying. Open a sample of converted files. Run any macros. Verify formulas calculate correctly. Check that named ranges are intact.

Frequently Asked Questions

Can PowerShell batch convert .xls files to .xlsx?

Yes — using Excel's COM interface, PowerShell can open each .xls file and save it as .xlsx. It requires Excel to be installed and processes files sequentially. VBA macros are silently stripped during conversion.

Will PowerShell lose my VBA macros when converting .xls to .xlsx?

Yes, if you save to .xlsx (format 51). Macros require .xlsm format (format 52) to survive — but .xlsm files won't satisfy requirements where .xlsx is specifically needed. LegacyLeaps gives you per-file control and full macro preservation, clearly flagged in the audit report.

How long does it take to batch convert 1,000 .xls files?

PowerShell with Excel automation typically takes 45-90 minutes for 1,000 files. LegacyLeaps processes the same batch in 5-10 minutes using parallel native conversion without requiring Excel.

What is the best tool for bulk .xls to .xlsx conversion with macro preservation?

LegacyLeaps is the only purpose-built tool that handles bulk legacy Office file conversion with full VBA macro preservation, per-file audit reporting, and local processing — files never leave your machine.

Ready to migrate your file batch safely?

Download LegacyLeaps and run the free scan against your .xls folder. See exactly which files have macros, which are safe to convert, and what the migration will look like — before you touch a single file.

Download Free Scanner

Get tips like this in your inbox

Practical fixes for legacy Excel and Access problems. No spam.

← Back to all posts