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

Hi, folks:

I have a Perl data structure, say an array of hashes, and I want to generate a Excel file based on such data under a web environment, i.e. mod_perl + HTML::Mason

What is the most light-weight and reliable Perl module to properly build Excel files from a table on the webpage [on the back-end an array of hashes] so that users can download the Excel file directly from my webpage (i.e. a link)?

Any experienced suggestion is appreciated.

many thanks

lihao

  • Comment on Quick question: generate Excel files on the web

Replies are listed 'Best First'.
Re: Quick question: Perl Module to generate Excel files
by Tanktalus (Canon) on Aug 20, 2009 at 21:20 UTC

    FYI, just as a fall-back in case no one with more experience comes by, you could always just send back CSV files. Excel can open those.

    Have you looked at CPAN? Which ones did you look at? First place I'd start is Spreadsheet::DataToExcel ... not sure how well it works. I don't use Excel, either ;-)

      I've built the CSV output by using Text::CSV without any problem. while the people who are using this webpage want to see Excel formated output, I have to fit their needs.

Re: Quick question: generate Excel files on the web
by VinsWorldcom (Prior) on Aug 21, 2009 at 12:07 UTC

    I've used Spreadsheet::WriteExcel to create Excel files beore pretty quickly and easily. However, to get the most functionality out of Excel files (depending on how complicated the data you'll be using is - eg: graphs, formulas, etc...), you should look at Win32::OLE - which is what I use now to create (and modify) Excel files.

    There is a good local tutorial for Win32::OLE and Excel at Using Win32::OLE and Excel - Tips and Tricks.