Spreadsheet

Excel: 'file format or extension is not valid'

This message almost never means the data is gone. It means the ZIP container Excel expects (an .xlsx is a zip of XML parts) has a damaged header, a truncated tail, or the file was actually saved in a different format than its extension claims.

Stop doing this first

The safe order of operations

  1. 1

    Copy the file somewhere else and work only on the copy — everything below is done on the copy.

  2. 2

    Check the real format: if the first bytes are PK it is a modern .xlsx zip; D0 CF 11 E0 means it is really an old .xls that was renamed.

  3. 3

    Rename the copy to .zip and try to open it. If the archive lists xl/workbook.xml, your data is still in there.

  4. 4

    Use Excel's own Open → Open and Repair on the copy, then 'Extract Data' if repair fails.

  5. 5

    If the zip is truncated, repair the archive first, then reopen it as .xlsx.

Commands that do the work

Identify what the file really is

file broken.xlsx && head -c 8 broken.xlsx | xxd

Inspect the OOXML parts

cp broken.xlsx copy.zip && unzip -l copy.zip

Repair a truncated archive

zip -FF copy.zip --out fixed.zip && cp fixed.zip fixed.xlsx

Convert with LibreOffice (often reads what Excel refuses)

soffice --headless --convert-to xlsx --outdir out/ broken.xlsx

Realistic odds

Usually likely recoverable — full recovery when the zip directory survives, partial when the tail is truncated.

Your case will differ in the details. Load this scenario into the recovery form and add what you already tried — you'll get a plan for your exact situation.

Get my recovery plan

Related guides