Re: How to build a program that can read the content of a very simple MS Excel file?



On 13/06/2007 11:24 AM, Huge Mountain wrote:
Hello everyone.
I'm trying to build a program to read the content of a Microsoft Excel file, just read a very simple Excel file (a file with text in cell A1, A2,..., don't care about formula, chart,...). I simply want to read the content of cell A1. With that, I can get the binary format of MS Excel file more clearly. Ex:if cell A1 have the content: "text message", my program can show "text message" as result. Could someone tell me how to do that, or where to find the references? I downloaded source, file " gnumeric-1.6.3.tar.gz" from http://www.gnome.org/projects/gnumeric/, but I don't know how to use, which to compile. I'm stray with >1000 files (some file I don't know how to open).
Please help me!
Thank in advance!

PS: I explored a simple MS Excel file (with "abc" in cell A1, this file was saved by MS Excel 2000). This file have 3 stream: SummaryInfomation stream, DocumentSummaryInfomation stream and Workbook stream. The only stream I care is Workbook stream, started from byte 512 to byte (512+4096) (this stream has the 4096 bytes length). So, where are bytes which contain the "abc" string of cell A1 in this 4096 bytes?
Please help me!


The format of an XLS file is extremely complicated. If you are desperate enough to want to do it yourself, see http://sc.openoffice.org/excelfileformat.pdf and note that the Workbook stream is not necessarily contiguous; you'll nead to read http://sc.openoffice.org/compdocfileformat.pdf.

If you want to try a pre-written Excel-reading library:
(1) Python: http://www.lexicon.net/sjmachin/xlrd [I'm the author]
(2) perl: look for Spreadsheet::Excel (or something like that) in cpan
(3) Java: http://poi.apache.org/hssf/index.html

HTH,
John






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]