Satish@Stag has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I would like to parse around 100 spreadsheets (.xls) and generate single spreadsheet (.xls) report fetching few important datas from those spreadsheets and then writing into a spreadsheet report. I would like to know if there is any single Perl module to do this activity or I have to use both SpreadSheet::ParseExcel and SpreadSheet::writeExcel. Thanks
  • Comment on Parsing spreadsheet and generating spreadsheet report

Replies are listed 'Best First'.
Re: Parsing spreadsheet and generating spreadsheet report
by mr_mischief (Monsignor) on Sep 10, 2007 at 06:38 UTC

    If you're doing this on Windows and can have Excel open, there's Spreadsheet::TieExcel. I haven't tried it. It looks a bit tricky compared to the Spreadsheet::(Parse|Write)Excel modules, which don't require you to be on Windows or to even own a copy of Excel.

    There are several DBD backends to DBI that can deal with Excel or with CSV files. They will let you query and insert. However, unless your data fits the SQL idea pretty well that's an awkward way to solve it. DBD::Excel is the most obvious, and I've used it. It's not bad. It works directly on XLS files. DBD::CSV, DBD::AnyData, and DBD::RAM can all handle CSV files.

    As moritz says, using Spreadsheet::ParseExcel and Spreadsheet::WriteExcel both should be neither difficult nor any major source of slowdown in your program.

    In a more general theme, if you want to know what else is available to work with Excel files, you can always go to http://search.cpan.org and search for 'Excel'. It'll give you these results.

Re: Parsing spreadsheet and generating spreadsheet report
by marto (Cardinal) on Sep 10, 2007 at 07:44 UTC
Re: Parsing spreadsheet and generating spreadsheet report
by moritz (Cardinal) on Sep 10, 2007 at 05:58 UTC
    I know of no single module to unify reading and writing, but the interface of both modules is simple, so you should not worry about the fact that you use two of them.

    There are other ways, like converting to XML with XML::SAXDriver::Excel and then write it with Spreadsheet::WriteExcel::FromXML, but I don't think will be easier.