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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.