Version 31 of Excel

Updated 2004-04-02 20:10:15

Excel is a spreadsheet written by The Evil Empire [L1 ]. It is a part of their MS Office suite of software.


Ways to get to .xls data: DDE; COM, especially tcom; CSV; ODBC (there are rumors of faults in the drivers, though); Victor Wagner's xls2csv [L2 ]; xhHtml [L3 ] is a command-line utility that can create XML output; Spreadsheet::ParseExcel and related Perl-coded modules available through CPAN; Christoph Bauer's tclexcel [L4 ]; http://www.greytrout.com ; SYLK; ...

There is a freely-available Excel viewer from Microsoft (MS Windows only) [L5 ]; For Linux/Unix, Gnumeric [L6 ] and StarOffice [L7 ] can import Excel files;


I have written a tcl wrapper Using Perl to get Excel to make the writing of excel files using perl's Spreadsheet:WriteExcel very managable - JBR.


More information is available through http://www.wotsit.org/ [find more precise URL]. http://www.wotsit.org/download.asp?f=xls

Links directly to the fileformat are not allowed anymore on wotsit. So you have to go to "Spreadsheet/Database" and look for "XLS".


["If you tab delimit the data and name it myfile.xls, current versions of excel will 'do the right thing'."] CL has recently had success with "pipe-delimiting"; that is, writing tabular data as simply as possible, with '|' separating fields. Office workers seem to accept this as "spreadsheet format".

Benny Riefenstahl: I have also have had success in opening simple HTML tables with Excel directly. This has the advantage of having a well-defined character encoding and makes it possible to use long multi-line text in cells.


The class library "Jakarta POI - HSSF - Java APIs with XML manipulate MS-Excel" (http://jakarta.apache.org/poi/hssf/ ) can be used in combination with TclJava.


Example fragment of COM-based access (read) of Excel spreadsheet:

    set cellVal [[$cells Item $msgNum $column] -get Value]

If you view a CSV file in Excel, columns are labeled A..Z, AA..AZ, BA.. To convert these column labels to numeric indexes (0..), so as to access the data with lindex, here's a little helper:

 proc excel'col2int col {
     set abc {- A B C D E F G H I J K L M N O P Q R S T U V W X Y Z}
     set int 0
     foreach char [split $col ""] {
          set int [expr {$int*26 + [lsearch $abc $char]}]
     }
     incr int -1 ;# one-letter columns start from A
 } ;# RS

See Mapping words to integers for a more general take.


It amuses the archaeologically inclined that, as KBK observes, "The kernel of the Excel solver is the singular-value decomposition from Wilkinson [presumably Handbook for Automatic Computation Volume II - Linear Algebra]. That's essentially 1971-vintage Algol, rewritten first in Fortran and then in C."


Category Application