Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I downloaded a file with a .xls extension. I thought it was a regular excel spreadsheet file so I opened it using Excel 2007.

However, it tells me that the file I'm trying to open is in a different format than specified by the extension.

I ignored the warning and opened it anyways, and it opened fine. Looked just like any other spreadsheet. I opened the file in a regular text editor and it was an HTML file using some custom XML namespace

<html xmlns:o='urn:schemas-microsoft-com:office:office'
xmlns:x='urn:schemas-microsoft-com:office:excel'
xmlns='http://www.w3.org/TR/REC-html40'>

<head>
<meta http-equiv='Content-Type' content='text/html; charset=windows-1252'/>
<meta name='ProgId' content='Excel.Sheet'/>
<meta name='Generator' content='Microsoft Excel 11'/>
<link rel='File-List' href='Book1_files/filelist.xml'/>
<link rel='Edit-Time-Data' href='Book1_files/editdata.mso'/>
<link rel='OLE-Object-Data' href='Book1_files/oledata.mso'/>

I looked up what it was and came across these

http://www.c-sharpcorner.com/UploadFile/kaushikborah28/79Nick08302007171404PM/79Nick.aspx http://www.glump.net/howto/web/serve-html-as-an-excel-file-from-a-web-application

It seems like these types of files are called "dynamic excel files" because it's easy to generate.

Anyways I was wondering if there was a proper way to name the files so that excel doesn't complain that the file format is different from the file extension?

share|improve this question
    
Why don't you just save the file as a proper .XLS/.XLSX instead? –  Karan Jul 15 '13 at 19:21
    
I am converting the files from xls to csv using some batch tools and would like to know the extension of the file before processing them. I would need to distinguish between the regular excel binary formats from these HTML formats. I could always make up my own extension like dxls or something but if there was already an established standard... –  MxyL Jul 15 '13 at 19:22
    
.xls is the proper extension. As karan mentioned, once you open it, why not file - save as so it doesn't cause a problem again? –  Raystafarian Jul 15 '13 at 19:24
    
This is an automated process, so if there was a way to automatically save it as a regular xls without writing macros or anything that would be nice. –  MxyL Jul 15 '13 at 19:25
1  
your question doesn't mention anything about wanting to automate a batch solution for converting the files. Perhaps you should edit the question and include the goal of what you're trying to do, why you need to do it and whether or not you know what is creating these files for you –  Raystafarian Jul 15 '13 at 19:27

1 Answer 1

The file is an .xlsx file, the standard format for Excel 2007 and later, verified by the xml format. The file has an extension of .xls, which is the extension for Excel 2003 and earlier. Thus the error about the file extension not matching the file format.

"Dynamic" Excel file doesn't really mean anything. If the file had been created by some third party program, the programmer must not have used the correct extension for the file format.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.