You can read excel files in python:
http://scienceoss.com/read-excel-files-from-python/
You can read Excel files in Perl:
http://www.thegeekstuff.com/2011/12/perl-and-excel/
How to read Excel files in Perl?
The Unix / Linux file utility can recognize excel and a large number of other files.
Output Example:
file ~/Download/*xls
/home/paul/Downloads/REDACTED1.xls: Composite Document File V2 Document, Little Endian, Os: Windows, Version 5.1, Code page: 1252, Author: Someones Name, Last Saved By: Somebody Else, Name of Creating Application: Microsoft Excel, Create Time/Date: Wed Jan 27 00:39:46 2010, Last Saved Time/Date: Sun Feb 28 13:55:47 2010, Security: 0 /home/paul/Downloads/REDACTED2.xls: Composite Document File V2 Document, Little Endian, Os: Windows, Version 1.0, Code page: -535, Author: Paul , Last Saved By: Paul , Revision Number: 3, Total Editing Time: 18:09, Create Time/Date: Wed Oct 26 23:45:51 2011, Last Saved Time/Date: Thu Oct 27 00:34:42 2011
You can simply create a library that calls file and returns the result.
To find out how file does this, the source code is available, and the file utility has its own configuration file and even a magic byte and line information configuration directory.
apt-get source file
./file-5.11/magic/MagDir is a directory full of magic bytes and strings to look for in a wide variety of formats, but the “compound document file” visible when checking my own excel files was not declared there. This directory There are definition files for Excel on Mac, Word, and some older msdos formats.
cd ./file-5.11; grep 'Composite Document File' */*
gives:
src/cdf.c: * Parse Composite Document Files, the format used in Microsoft Office src/cdf.c: * NB This is the "Composite Document File" format, and not the src/cdf.h: * Parse Composite Document Files, the format used in Microsoft Office src/cdf.h: * NB This is the "Composite Document File" format, and not the src/readcdf.c: if (file_printf(ms, "Composite Document File V2 Document") src/readcdf.c: if (file_printf(ms, "Composite Document File V2 Document")
which I would suggest you study to determine how the file utility can detect some Microsoft Excel formats.