in reply to Setting format in Excel using perl

Hi jsuresh

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

Replies are listed 'Best First'.
Re^2: Setting format in Excel using perl
by jsuresh (Novice) on Apr 11, 2018 at 06:53 UTC
    Hi Rata,

    Yeah, Exactly, I will definitely take your approach for my upcoming projects.Thanks for your support.

    Thanks again,