The file format and extension of filename.xls don't match. The file could be corrupted or unsafe

Viewed 476

My code exports an excel (.xls) file as HTML from a webpage. On opening this downloaded file, I get an error saying:

The file format and extension of filename.xls don't match. The file could be corrupted or unsafe. Unless you trust its source, don't open it. Do you want to open it anyway?

On clicking yes, it displays the contents correctly. Is there a way to get rid of the warning?

Other questions addressing this error have suggested changing the extension from .xls to .xlsx, but that completely prevents the files from opening in my case.

To clarify, I am not importing HTML data into an excel spreadsheet. I am representing an excel spreadsheet as HTML. I can share the file if required.

0 Answers
Related