← Office File Repair

Excel: “The file format or file extension is not valid”

The full message is “Excel cannot open the file 'Budget.xlsx' because the file format or file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file.” Excel means: what's inside the file isn't what the name promises. There are three possible reasons, and only one of them is damage.

Find out which one you have

Right-click the file → Open with → Notepad, look at the first few characters, then close Notepad without saving.

The file starts withWhat it meansWhat to do (free)
PKA real .xlsx. Either it's damaged, or Excel isn't allowed to read it. See “Blocked” and “Damaged” below.
ÐÏà¡An old-style Excel file (.xls), or a password-protected workbook. Rename the copy to .xls and open it. If it asks for a password, it's encrypted, not broken.
<html, <?xml or <table A web page or XML export with an Excel name. Common from banking, accounting and school systems. Rename the copy to .html (or .xml) and open it from Excel with File → Open.
Plain text with commas or tabsA CSV or text export. Rename the copy to .csv and open it.
Nothing, or only blank squaresThe file is empty or zeroed. See file shows 0 KB.

Gibberish after PK is normal: an .xlsx is a compressed zip folder.

Blocked: Excel isn't allowed to read it

If the file starts with PK and opens on another computer or in Excel for the web, it isn't damaged.

  1. Right-click → Properties and tick Unblock on the General tab, if it's there.
  2. Copy it out of OneDrive, Dropbox or a network share into Documents, then open it from Excel with File → Open.
  3. Check you have permission to read it (Properties → Security).
  4. On a Mac, Excel may ask you to grant access to the folder. Click Select / Grant Access.

Damaged: the free fixes

  1. Work on a copy.
  2. File → Open → Browse, select the file, click the arrow next to Open and choose Open and Repair. If Repair fails, try again with Extract Data.
  3. Look for an earlier version: right-click → Properties → Previous Versions, or OneDrive / SharePoint version history.
  4. Open it in LibreOffice Calc or upload a copy to Google Sheets.

If none of these work, the zip structure itself is usually broken: the save was cut short, or part of the file was overwritten. Excel needs that structure intact before its repair can even start.

Where Office File Repair helps

Office File Repair reads the zip piece by piece even when its index is missing, so it gets further than Excel on cut-short and partly overwritten files. It keeps every sheet it can read, cuts damaged sheets back to the last complete row, and builds a fresh .xlsx that opens normally. The preview shows the rows that came back before you pay, and the file never leaves your computer.

When nothing can help

If the file is all zeros or 0 KB, there are no numbers left in it. If a sheet was cut off part-way, the rows after the cut are gone too. Text cells can also come back empty when Excel's shared list of text was lost: the numbers survive, the words don't. In those cases an earlier version is your best bet.

Common questions

How do I fix “Excel cannot open the file because the file format or file extension is not valid”?

Open the file in Notepad and look at the first characters. PK means it's a real .xlsx, so unblock it or repair it. Other starts mean it's a .xls, web page or CSV with the wrong name: rename a copy to match and open it.

Can I just change the file extension to fix it?

Only if the file is really another format, such as a .xls, .csv or .html export saved with an .xlsx name. Renaming a damaged .xlsx doesn't repair it.

Why does a file from my bank or accounting software give this error?

Many systems export a web page or text file and name it .xls or .xlsx. Rename a copy to .html or .csv and open it from Excel.

Is my Excel file corrupted if it starts with PK?

Not necessarily. PK is the normal start of every .xlsx. If it opens on another computer it's fine and only blocked on yours; if it fails everywhere, it's damaged.

Check your spreadsheet: the preview is free

Related: Excel: “We found a problem with some content” · Excel found unreadable content · “The file is corrupted and cannot be opened”