in reply to Re: Spreadsheet::ParseExcel::Simple
in thread Spreadsheet::ParseExcel::Simple, reading specific cells?

I tried lookin through the Spreadsheet::ParseExcel module too...but, I couldn't really understand how to get the program to scroll through columns and rows. Like, I'm considering using 2 for loops. The first go through the rows, while the second one goes down the column inside the row. Anyways, the problem is that the ParseExcel module doesn't really offer a good explanation of how I'd go about doing this.
  • Comment on Re: Re: Spreadsheet::ParseExcel::Simple

Replies are listed 'Best First'.
Re: Re: Re: Spreadsheet::ParseExcel::Simple
by CombatSquirrel (Hermit) on Aug 24, 2003 at 20:15 UTC
    If you should afterall be interested in Spreadsheet::ParseExcel, then maybe the following code from the docs (after naming the variables with slightly better readable names) is going to help you
    use strict; use Spreadsheet::ParseExcel; my $BookObject = Spreadsheet::ParseExcel::Workbook->Parse('Excel/Test9 +7.xls'); foreach my $WorksheetObject (@{$BookObject->{Worksheet}}) { print "--------- SHEET:", $WorksheetObject->{Name}, "\n"; for(my $RowIndex = $WorksheetObject->{MinRow}; # starting at minimu +m row value defined $WorksheetObject->{MaxRow} && $RowIndex <= $WorksheetObject->{MaxRow}; # ending at maximum +row value $RowIndex++) { for (my $ColumnIndex = $WorksheetObject->{MinCol}; defined $WorksheetObject->{MaxCol} && $ColumnIndex <= $WorksheetObject->{MaxCol}; $ColumnIndex++) { $CellObject = $WorksheetObject->{Cells}[$RowIndex][$ColumnIn +dex]; # get cell print "( $RowIndex , $ColumnIndex ) =>", $CellObject->Value, "\n" # print cell contents ... if ($CellObject); # ... if cell exists } } }
    Overview over the Spreadsheet::ParseExcell class:
    class Spreadsheet::ParseExcel
        | via ->Parse
       class Spreadsheet::ParseExcel::Workbook
           | via ->{Worksheet}
          class Spreadsheet::ParseExcel::Worksheet
               | via ->{Cells}[$Row][$Column]
             class Spreadsheet::ParseExcel::Cell
    And as well, but not so important:
    class Spreadsheet::ParseExcel::Format
    class Spreadsheet::ParseExcel::Font
    class Spreadsheet::ParseExcel::Fmt
    Hope this helped.
    CombatSquirrel.