2012-08-27 95 views

回答

1

您可以在python讀取Excel文件:

http://scienceoss.com/read-excel-files-from-python/

您可以在Perl讀取Excel文件:

http://www.thegeekstuff.com/2011/12/perl-and-excel/

How can I read Excel files in Perl?

的Unix/Linux操作系統實用file能識別excel和大量的其他文件。

輸出示例:

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 

你可以簡單地建立一個呼叫file並返回結果的庫。

要查看file是怎麼做的,源代碼是可用的,並且file工具都有自己的配置文件和魔偶字節和字符串信息的配置目錄。

apt-get source file

./file-5.11/magic/MagDir是一個充滿神奇的字節和字符串目錄中的一個大的各種格式的尋找,而是「複合文檔文件」在我自己的掃描所見excel文件沒有在那裏聲明。這個目錄在Mac上有Excel的定義文件,Word和一些舊的msdos格式。

cd ./file-5.11; grep 'Composite Document File' */*

產量:

src/cdf.c: * Parse Composite Document Files, the format used in Microsoft Office 
src/cdf.c: * N.B. 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: * N.B. 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") 

,我建議你可以調查,以確定file實用程序是如何能夠檢測一些微軟的Excel格式。