Re: Setting format in Excel using perlby Ratazong (Monsignor)
|on Apr 11, 2018 at 06:11 UTC||Need Help??|
As others have shown, it is totally possible to format cells in Excel using perl. However in my experience this is probably not the easiest way.
My typical use-case seems to be similar to yours: fetch some data from some databases, combine it, and present it in Excel-reports. These reports shall be "beautiful", having suitable column widths, suitable text and number formatting, highlighted headers, often cell-borders ...
Creating all this in perl takes time, and makes my code very dependant on the output-format. (E.g. if someone wants the comment-field to be 20% wider, I would have to update the code.)
So I don't start writing to an empty Excel-sheet, but prepare a template. And do all the formatting in this template, using Excel. My script then just writes the data in the corresponding fields/columns, and does not have to care about formatting itself. And finally stores the template under a different filename.
Maybe this approach is also helpful for your future projects
Best regards, Rata