I can support winds recommendations.
For working with Excel, I am using Win32::OLE a lot -and I am happy with it.
- However it works only if you are in a windows-environment ... and have Excel installed
- While even executing macros embedded in my documents works, I try to keep things as easy as possible:
- I try to avoid formatting cells
- I try to avoid creating charts etc. dynamically
Even if both are possible (and sometimes needed), I think it makes my code "nasty"(*) and hard to mantain.
Instead I create pre-formatted Excel-templates manually, which then I fill from Perl. Works fine :-)
wind also proposes Spreadsheet::ParseExcel and Spreadsheet::WriteExcel.
While I have never used them, they get recommended very often here ... so they are probably an
excellent choice too.
Have fun! Rata
update: explanation of "nasty": (thanks for the feedback, davies)
I typically get a lot of data from our databases and create some grouping and statistics.
The result should be reported in Excel. Of course the readers want the resulting Excel-sheets
to look nice - some text should be bold, some normal, some cells need borders, different column widths, different background-colors ...
Of course it can be done with Win32::OLE. This link shows how.
But soon I had hundreds of lines of pure Excel-formatting - many more than needed for retrieving, processing and writing the data. And I didn't like that. Especially after receiving requests
to change column-orders and style-changes. That's why I consider it being "nasty" - and went to the manually-formatted template-solution.
|