Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: Setting format in Excel using perl

by Ratazong (Monsignor)
on Apr 11, 2018 at 06:11 UTC ( #1212654=note: print w/replies, xml ) Need Help??

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 (Acolyte) 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,


Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1212654]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2023-03-21 16:52 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (60 votes). Check out past polls.