Excel guide · 4 min read
Fix "Excel cannot open the file because the file format or file extension is not valid"
Sample data
Every result on this page was calculated from this sheet by the same spreadsheet engine the Cellwise app uses.
| A | B | C | |
|---|---|---|---|
| 1 | First characters in Notepad | The file is really | Rename it to |
| 2 | PK followed by symbols | A modern workbook (zip) | .xlsx, or .xlsm if it has macros |
| 3 | ÐÏ followed by symbols | An old binary workbook | .xls |
| 4 | Words separated by commas | A CSV text file | .csv |
| 5 | <html or <table | A web page export | .htm, or open it and Save As .xlsx |
| 6 | Blank, or the file is 0 KB | An unfinished download or sync | Download or sync it again |
Why Excel refuses the file
An .xlsx file is a zip package of XML files. When Excel opens something called .xlsx, it expects that package. If the file is really a text CSV, an old .xls, a web page or half a download, Excel can't read it and shows the full message: Excel cannot open the file 'Report.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.
A close cousin appears for .xls files: The file format and extension of 'Report.xls' don't match. That one offers Yes to open anyway, and it's usually a report exported by another system as HTML or text with an .xls name. Only click Yes if you trust where the file came from.
1. See what the file really is
Windows hides extensions by default, so you may be looking at Report.csv.xlsx or Report.xlsm without knowing. In File Explorer choose View > Show > File name extensions (in Windows 10, tick File name extensions on the View tab).
Then right-click the file, choose Open with > Notepad, and look at the first few characters. The table above shows what each start means. Close Notepad without saving. Rename a copy of the file to the matching extension and open that copy in Excel.
The classic case: someone renamed export.csv to export.xlsx, thinking that converts it. It doesn't. To turn a CSV into a workbook, open the CSV and use File > Save As > Excel Workbook (*.xlsx).
2. A macro workbook saved with the wrong extension
Workbooks with macros must be .xlsm (or .xlsb). If an .xlsm file is renamed to .xlsx, its contents still say macro-enabled, and Excel won't open it under the .xlsx name. Rename it back to .xlsm and it opens. Excel may then show a security bar about macros; only enable them if you trust the file.
3. The file is incomplete: download, email or sync
Check the file size in File Explorer. A workbook that shows 0 KB, or far smaller than it should be, didn't finish copying. Download it again, or ask the sender to resend it. For email attachments, save the attachment to a folder first rather than opening it straight from the message.
For OneDrive or SharePoint files, look at the status icon next to the file. A cloud icon means it's online only; a red cross means a sync error. Right-click and choose Always keep on this device, or open the file from the OneDrive website instead.
Files from the internet or email can be marked as blocked. Right-click the file, choose Properties, and on the General tab tick Unblock if it's there, then click OK and try again.
4. A real workbook that's damaged: Open and Repair
If Notepad shows PK at the start and the size looks right, the workbook itself may be damaged. Excel has a built-in repair. If Repair can't fix it, run Open and Repair again and choose Extract Data, which recovers the values and, if you choose, the formulas.
Before you overwrite anything, check for an older good copy: File > Info > Version History for OneDrive and SharePoint files, or right-click > Properties > Previous Versions for files on a backed-up PC.
- In Excel, go to File > Open > Browse.
- Select the file, but don't double-click it.
- Click the small arrow next to the Open button and choose Open and Repair.
- Click Repair. If that fails, repeat and click Extract Data.
- Save what you recover with File > Save As under a new name.
5. A CSV that keeps going wrong: import it instead
If the file is really text, open it through Data > Get Data > From File > From Text/CSV (Data > From Text/CSV on some versions). The preview lets you pick the delimiter and the file origin, so commas, semicolons and accented characters come through properly, and you can keep codes like 00123 as text instead of losing the zeros. Then save the result as .xlsx.
Common mistakes
Renaming a CSV to .xlsx to convert it
Open the CSV and use File > Save As > Excel Workbook. Renaming changes the label, not the contents.
Running Open and Repair on a file that's really a CSV or half a download
Check the first characters in Notepad and the file size first. Repair only helps genuine workbooks.
Repairing the only copy and saving over it
Work on a copy, and save the repaired version under a new name until you've checked it.
FAQ
How do I fix "file format or file extension is not valid" in Excel?
Show file name extensions, open the file in Notepad to see what it really is, and rename it to match (.csv, .xls or .xlsm). If it's a damaged workbook, use File > Open, the arrow next to Open, then Open and Repair.
Why does a file I downloaded say the format is not valid?
Usually the download didn't finish, or the site sent a CSV or web page with an .xlsx name. Check the size, download it again, and look at it in Notepad.
Can I recover data from an Excel file that won't open?
Often. Try Open and Repair, then Extract Data. For OneDrive or SharePoint files, File > Info > Version History may have a good earlier version.
What does PK at the start of a file mean?
It's the signature of a zip package, which is what .xlsx, .xlsm and .xlsb files are. If Excel still won't open it, the workbook is probably damaged or has the wrong one of those extensions.
Related guides
- How to recover an unsaved Excel file
- Excel Protected View: why you can't edit and how to fix it
- Excel file is locked for editing: how to fix it
- Excel not responding: how to unfreeze it and stop it happening
- How to remove read-only from an Excel file
- Excel scroll bar too small: how to fix it
- How to enable macros in Excel
Updated