in reply to Re: content triggered parsing in Spreadsheet-ParseExcel
in thread content triggered parsing in Spreadsheet-ParseExcel

Hi hdb,

thanks very much for the code. i learned a lot from it but still have some questions. Most of them may seem straightforward to you but I hope get them clarified.

1. last unless defined($cell); i think it is used to tell the loop when to stop, e.g. when the loop stops when it reaches the undefined cell.

2. my $data = $worksheet->get_cell($row++, 1)->value(); I guess this line increments the row number by one AFTER it fetches the column value.

3.

if( $key eq "School" ) { $school = $data; } else { $data{$school}{$key} = $data; }

this i am not sure, but it seems to me that the hash table %data has 2 layers, first is school, the second contains the rest facts. If it reaches the $school row, record it as first layer key. And record the rest as other keys? Please correct me.

Thanks a lot in advance!

Replies are listed 'Best First'.
Re^3: content triggered parsing in Spreadsheet-ParseExcel
by hdb (Monsignor) on Mar 27, 2013 at 09:46 UTC

    No corrections required. You got it all correct.

      thanks for the quick respond!
      Hi again, I hope i am not asking too much. But then how could I out-write the hash data to a new xls file? Ideally, the new excel table should look like:
      col1 col2 col3 col4 row1 School Dean No.stu. No.teacher row2 1 John 55 row3 2 Tony 60 row4 3 James 56 20
      Best regards,