I don't know how many times you need to do this, how often and whether you need a 100% automated process or not. I really like biohisham's suggestions but its not "cheating" to use some of the features of Excel to help you.

I remember one project a long time ago where I had to produce a report in WinWord format once per week. I used Perl as sort of "glue" code to query a weird legacy database on a mainframe and do a bunch of reformatting, sumarizing, translating terms, etc. The output was a text file.

I wrote a Word macro to womp on this Perl generated text file.
So for the process: I ran my Perl program, then opened the resulting file in Word and hit like CTRL-R to make the fancy report. Now of course I designed the text file output to make this Word macro easy to write! But this whole process even with a couple of manual steps took just a minute or two. I never refined the process past that because there was no need...couple of minutes per week was no big deal - it took a lot longer than that to print it and Xerox copies for the management meeting!

You appear to have a simple spreadsheet with 2 columns that would be easily adapatable to this kind of approach. Perl generates a CSV file. Excel macro, imports this file, sizes columns, sets fonts(heading and data), etc. Maybe even this report should be a Word doc with 2 or 3 of these (term, Y/N) paired columns per page?(Word macro can do that).

I don't know the whole picture of what are doing. For all I know just opening this Perl generated CSV file in Excel and then save as "some Excel format" is enough. I use this technique often when doing "one off" reports to send to folks who do wonders with Excel but have never seen any real program code in their lives.

Anyway, when thinking about how fancy to get with say Win32::OLE, you may just need ability to open the file and run a template/macro. Then font type stuff, column width is in this Excel/Word template, not in your Perl code.

This won't solve world hunger, it is just an idea...


In reply to Re^2: Writing to an Excel file by Marshall
in thread Writing to an Excel file by NorthShore44

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.