Excel says the file format and extension don't match — what the file really is
Excel checks the first bytes of a file against its name, and when report.xls turns out to be a web page containing a table, or plain comma-separated text, it warns that the format and the extension disagree. The file is not corrupt: the system that produced it named it for the program it expected you to use. Open it as what it actually is and the rows come straight out.
Find out what the file actually is
Open the file in a plain text editor, or change its name to end in .txt and open that. Text that begins with <html or <table is a web page — the most common case, because many reporting systems build their "Excel export" as an HTML table and name it .xls. Lines of values separated by commas, semicolons or tabs are a CSV. Text that begins with PK is a real modern workbook that was named .xls instead of .xlsx, and renaming it back is the whole fix.
Clicking Yes in the warning usually opens the file anyway, and that is fine for a look. It is not fine for the data: numbers and dates are reinterpreted on the way in, and a file saved from that view has lost whatever Excel decided to change.
A web page named .xls
The HTML table extractor here reads the page as it is: paste its source, or drop the file, and every table in it is listed for you to pick one. The rows come out as CSV with every cell as the text on the page, so 00412 keeps its zeros and 1,234.50 keeps its comma. Cells that span rows or columns are repeated into the cells they cover, so the columns line up.
If the file needs to reach someone as a real workbook, convert that CSV to Excel here afterwards; the converter writes text cells, which Excel shows as-is.
Text named .xls or .xlsx
Rename the file to end in .csv and it is what it always was. The health check will tell you the separator and the encoding it found and list anything that looks off; the editor opens it with every value as written; the Excel converter turns it into a workbook that opens without the warning.
If the text uses semicolons or tabs rather than commas, the delimiter fixer rewrites it into the comma form every program expects, carrying every value through untouched.
Questions
- Is the file corrupt?
- Almost never. The warning means the contents and the name disagree, and the usual reason is a system that names its HTML or CSV export .xls. Open it in a text editor and the first line tells you what it is.
- Is it safe to click Yes and open it anyway?
- To look, yes. To keep, no: Excel reinterprets the values as it opens them, so codes lose zeros and long numbers are rounded, and saving writes the changed version. Take the rows out with a tool that keeps them as text instead.
- Why do systems name a web page .xls?
- Because Excel will open it, with a warning, and the developer never had to write a real workbook. It worked for years, and now every version of Excel warns about it.
- How do I get a proper .xlsx from it?
- Extract the table to CSV here, then convert that CSV to Excel. The result is a real workbook, with every value as a text cell, that opens without any warning.
- What if the file really is a workbook?
- A file starting with the letters PK is a modern workbook; if it is named .xls, rename it to .xlsx. A file that starts with other unreadable bytes may be an old-format workbook with a new name, and renaming it to .xls fixes that one.
- Is my file uploaded anywhere?
- No. The table is pulled out of the mislabelled file inside this page, and this site never fetches anything — which is also why the extractor asks you to bring the file to it rather than give it an address.