• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 396
  • Last Modified:

Is an Excel file a true Excel file?

Here's a little history on the issue:

I hired contractor 1 to push data from a MSSQL SELECT stored procedure into an Excel 2003 spreadsheet using my ASP.NET interface. The sneaky little #%!# tried to fake it. He pushed my SELECT stored procedure data into an HTML table and assigned an XLS file extension to the file. Sure enough, Excel opened the file, but it wasn't a true Excel file.

Contractor 1 is gone. Enter contractor 2. I hired him to do the same thing. I'm reasonably sure that his work is genuine. I've attached it. Are there clues I can look for in the metadata to assure it is a "true" Excel file?
Sample.xls
0
jdana
Asked:
jdana
3 Solutions
 
KyleSWCommented:
I'm a little confused, both are "true" Excel files so what's the issue with the approach?

The method he used is quite common, so is pumping out data as csv and changing the extension in the same manner.

Why wouldn't this be an acceptable approach?
0
 
netballiCommented:
Simple test is files saved in excel format cannot be opened or edited by text editors.
0
 
urzicaCommented:
Hi jdana,

Well, there is the Office Validation Tool add-on. However, I think it's focused on checking for malicious code, so if one simply changes the extension I don't think it will notify you.

What you can do, if you feel like it, is comparing the header code, as a file signature. For instance, if you open Excel files with PEview, you can see that they start with a specific Hex code, while a text file that was renamed as an Excel file will not have the same header.

There might be an automatic tool that can validate this, instead of checking manually for the header code, but I don't know any such tool.

If you're interested in this solution I'd be glad to explain more if needed.
Regards,
urzica

P.S.
I checked the sample file, and it seems it has a correct Excel header of "d0 cf 11 e0 a1...." as you can see here:
http://www.garykessler.net/library/file_sigs.html

Last Edit:
I'm leaving my answer here just for the information if it can be useful to you, but it's not really a good solution for you, since it will only work if the file format was changed and that's it. However, if once it was changed the user also opened the "Excel" file and re-saved it as an Excel file, it will have a regular Excel header, so you won't know if it was originally created with Excel (and I don't think you could ever know once he re-saves the file with Excel).
0
 
redmondbCommented:
Edit: Apologies all - incorrect post removed.
0
 
jdanaAuthor Commented:
Great answers guys.

KyleSW - Your suggestion that an HTML format may be acceptable is a good one.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now