Fix Corrupted XLSX Files — Step-by-Step
An Excel file that won't open is a separate problem from an Excel file with a forgotten password. Corruption can come from many causes — incomplete saves, ransomware encryption, network transfer errors, broken zip headers, or actual data damage in the underlying XML. This guide walks through diagnosing the corruption type and applying the right repair technique. Most corrupted .xlsx files have salvageable content if you don't make things worse first.
Step 1 — Always work on a copy
The most common mistake when dealing with corrupted Excel files is repairing in place. Make a backup copy first — recovery operations sometimes worsen the file (especially Excel's own 'open and repair' which can silently discard partial data).
Recommended: keep three versions of the file as you progress: original (untouched), working copy (where you try repairs), and any successfully recovered output. If a repair makes things worse, revert to original and try a different approach.
Backup discipline
Even read operations on a corrupted file can occasionally make it worse if Excel auto-saves a partial reconstruction. Work on copies, label clearly, never overwrite the original.
Step 2 — Diagnose the corruption type
XLSX files are ZIP archives with XML inside. The corruption type tells you which repair to attempt. Open the file with 7-Zip or any ZIP tool (rename to .zip if necessary). Three broad categories:
- ZIP-level corruption: 7-Zip reports 'unexpected end of archive' or refuses to open. Likely incomplete download or transfer error.
- XML-level corruption: 7-Zip opens fine but Excel reports 'unreadable content'. Some XML file inside is malformed.
- Schema-level corruption: All files extract cleanly but Excel chokes on relationships or shared strings. The file is structurally complete but logically broken.
Step 3 — ZIP-level repair
If the file fails to open as a ZIP at all, the ZIP central directory is damaged. Try: (a) zip -F file.xlsx --out repaired.xlsx (Linux/macOS unzip-utils — fixes minor central directory issues); (b) DiskInternals ZIP Repair, WinRAR's 'Repair Archive', or 7-Zip's 'Test archive' which sometimes recovers content even from damaged headers; (c) for severe cases, manually rebuild the central directory from the local file headers using zr or similar.
If the original transfer was incomplete (partial download), there's no recovery — you need to re-transfer from the source. Verify file size against expected size before attempting repair.
Step 4 — XML-level repair
If the ZIP opens fine but Excel reports unreadable content, the XML is malformed. The error message in Excel usually indicates which file is the problem — 'Repaired Records: ...' lists the affected sheet or component.
Common XML corruption: stray null bytes, truncated end tags, invalid characters in strings. Open the affected XML file (e.g., xl/worksheets/sheet1.xml) in a text editor that handles UTF-8 cleanly. Look for unclosed tags or non-XML characters near the end of the file. Manual fixes are often viable for simple cases.
For complex cases, use a full XML validator (xmllint --noout file.xml) to identify exact errors. Frequently the fix is a single missing close tag or a stray character that broke a CDATA block.
Step 5 — Schema-level repair
Files where every component is structurally valid but Excel still misbehaves are typically suffering from broken relationships (xl/_rels/workbook.xml.rels) or sharedStrings issues. These reference IDs that no longer exist in the file.
Symptoms: cells show #REF! errors after open, or formulas break, or shared text strings are missing. The file is technically readable but logically inconsistent.
Repair: examine xl/_rels/workbook.xml.rels and xl/sharedStrings.xml. Cross-reference IDs against actual files. Remove orphan references or restore missing files from a backup.
Step 6 — When professional repair makes sense
Specialised repair tools (Stellar Repair for Excel, Recovery Toolbox for Excel, ExcelRecovery) handle complex schema corruption automatically. They cost more than free tools but reliably extract content from cases where manual XML editing is impractical.
For files with high business value (financial models with hundreds of sheets, year-end accounts, audit-relevant records), the cost of professional repair is usually justified. Free DIY for one-off personal files; paid tools for irreplaceable business content.
Step 7 — Recover what you can
Sometimes full repair is impossible but partial recovery is. Strategies: (a) extract individual sheet XML files and import them into a fresh workbook; (b) parse cell values directly from sheet XML using Python (openpyxl in read-only mode) and reconstruct as a new workbook; (c) use LibreOffice Calc, which is more permissive than Excel for malformed files.
Partial recovery is better than zero recovery. Even a sheet without formatting or formulas often beats starting from scratch.
What happens with password-protected corrupted files
If the file is both encrypted (file-open password) and corrupted, repair must come before password recovery. The encrypt dictionary needs to be parseable to even attempt decryption.
If you can't open the encrypt dictionary, that's a structural repair problem first. Once the file is structurally valid (even if you can't read content), normal password recovery applies. This sequencing matters — don't try to crack a password on a file that won't even ZIP-open.
5-step XLSX repair flow
- 1
Copy the original
Make at least 2 backup copies before any repair attempt.
- 2
Open as ZIP
Test with 7-Zip whether the ZIP container is intact.
- 3
Identify problem level
ZIP-level (unopenable), XML-level (Excel reports unreadable content), or schema-level (opens but logic broken).
- 4
Apply matching repair
ZIP repair tools, XML editor, or schema cross-reference. Match technique to corruption type.
- 5
Verify and document
Open the repaired file, verify expected content, document what was lost in case full recovery isn't possible.
Frequently Asked Questions
Will Excel's 'Open and Repair' damage my file?
Can a corrupted .xlsx be password-recovered?
What about ransomware-encrypted .xlsx?
How do I know if it's worth professional repair?
Is LibreOffice better at opening broken .xlsx?
Can I prevent .xlsx corruption?
Need Office password recovery?
Run a free analysis — encryption type detected automatically, fast techniques tried first, pay only on success.
Run Free Analysis