Ok, I've RTFM several times, and still I'm not quite grasping how to get the background color (shading) of a cell in an Excel worksheet with Spreadsheet::ParseExcel. I can get the data from the individual cells, taking nearly directly from the well-cited example included in the documentation:
$oBook = Spreadsheet::ParseExcel::Workbook->Parse("$strExcelPath"); foreach my $oWkS (@{$oBook->{Worksheet}}) { print "--------- SHEET:", $oWkS->{Name}, "\n"; for(my $iR = $oWkS->{MinRow} ; defined $oWkS->{MaxRow} && $iR <= $oWkS->{MaxRow} ; $iR++) { for(my $iC = $oWkS->{MinCol} ; defined $oWkS->{MaxCol} && $iC <= $oWkS->{ +MaxCol} ; $iC++) { $oWkC = $oWkS->{Cells}[$iR][$iC]; print "( $iR , $iC ) =>", $oWkC->Value, "\n" if($oWkC) +;
But I need not only the cell value, defined in $oWkC->Value, but the background color of the cell. The documentation provides that "Format" is a cell property, the same way "Value" is. So...
$oFormat = $oWkC->Format;
Should return the format information to the $oFormat object. Now, Fill is a property of the Format object, so...
$oFill = $oFormat->Fill;
Should return, according to the documentation: Array ref of fill pattern and color indexes : [Pattern, Front Color, Back Color] But this is where I'm stuck. No matter how many different ways I've tried writing it, I am unable to get the program to spit out the Pattern, front color, or back color. Can anyone help me out with the proper format of this?

Update - Thank you very much, ptum and jmcnamara - your replies not only helped me reach my solution, but have helped me learn a little bit more about this sort of form (and how the documentation may appear behind it!). As usual, you more experienced monks are knowledgeable and helpful!

In reply to ParseExcel - need background color info by bblustein

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.