in reply to How can make a consult from M$ Excel to a perl program?


It isn't exactly clear what you need to do so here are a few suggestions of the usual ways to get Perl to interoperate with Excel:

* DBI with DBD::ODBC or DBD::ADO. Excel files contain an internal index table which allows them to act like a database file. Using one of the standard Perl database modules you can connect to an Excel file as a database for reading or writing.

* The Win32::OLE module and office automation. This requires a Windows platform and an installed copy of Excel. This is the most powerful and complete method for interfacing with Excel for reading, writing or anything else. See the examples here and here.

* Spreadsheet::ParseExcel. This uses the OLE::Storage-Lite module to extract data from an Excel file.

Also, you can usually connect Excel directly to a database and manipulate the data in that way.

John.
--

  • Comment on Re: How can make a consult from M$ Excel to a perl program?

Replies are listed 'Best First'.
Re: How can make a consult from M$ Excel to a perl program?
by tinman (Curate) on Mar 21, 2001 at 00:10 UTC

    Coincidentally, I was doing an app that interfaces with Excel sheets just yesterday.. all of these options are available..

    there is also a somewhat more obscure workaround, where I open the Excel sheet as an OLE container and call the SaveAsCSV method... then use Text:CSV (Text::CSV_XS) to manipulate the data. One would have to convert the sheets offline.. I rejected this because I didn't really like to handle OLE inside a CGI app, just thought it might give me performance issues later on..

    Spreadsheet::ParseExcel is quite good.. a new release was submitted to CPAN on the 17th of March (0.18, I do believe), and it allows display of an Excel sheet as a multi dimensional array..

    Just a bit of insight on what I've done with Excel sheets.. if you want to see any examples (admittedly, almost all of it is off man pages ;o) just let me know..