ssn642 has asked for the wisdom of the Perl Monks concerning the following question:

Is it possible to open an existing XLS file (that was created previously by the WriteExcel module) by using the WriteExcel module or any other module, except WIN32OLE?
  • Comment on Spreadsheet-WriteExcel open existing XLS file

Replies are listed 'Best First'.
Re: Spreadsheet-WriteExcel open existing XLS file
by dragonchild (Archbishop) on Nov 03, 2007 at 01:02 UTC
    For the most part, Spreadsheet::ParseExcel will read those files. There is a known caveat about formulas, but that's well-documented.

    My criteria for good software:
    1. Does it work?
    2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
      Will Spreadsheet::ParseExcel allow me to add data to the XLS file and then save? Here is my story so far: I wrote a Perl program to create and add data to a XLS spreadsheet using WIN32OLE. My company, now, will not let me install Excel on the server. So I now need to recreate the script so as not to use the actual Excel application. So I need to find a way to open, add data, and then save the XLS spreadsheet using Perl.
        There is currently no one-stop solution that provides reading and writing of Excel files without Win32::OLE. Putting one together with both WriteExcel and ParseExcel shouldn't be too hard. If you want some help, I'd be glad to give some advice. A solution using tie and DBM::Deep for the data structures might be kinda cool.

        My criteria for good software:
        1. Does it work?
        2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?

        Spreadsheet::ParseExcel contains a sub-module called SaveParser that is a combination of ParseExcel and WriteExcel and which allows you to add data to an existing Excel file.

        It is far from perfect but it might work for you.

        Here is an example.

        --
        John.

Re: Spreadsheet-WriteExcel open existing XLS file
by dorko (Prior) on Nov 03, 2007 at 01:43 UTC
    I like Spreadsheet::TieExcel for reading and writing Excel files, but it only works on Windows with Excel installed.

    Cheers,

    Brent

    -- Yeah, I'm a Delt.
Re: Spreadsheet-WriteExcel open existing XLS file
by CountZero (Bishop) on Nov 03, 2007 at 21:32 UTC
    If your company does not allow you to install Excel, can you install Open Office? Open Office can read in Excel files and save them in its own format, which you can then manipulate with modules such as OpenOffice::OOBuilder, OpenOffice::OOSheets or OpenOffice::Parse::SXC.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James