in reply to Re: Reading huge spreadsheets using Spreadsheet::ParseExcel...
in thread Reading huge spreadsheets using Spreadsheet::ParseExcel...

the link to "reducing the memory usage" was actually helpful; i followed the tips and it got rid of the "out of mem" error all right; but i stumbled on a diff. problem now; what do i do in the cell handler function so that i can read the cell contents using the get_cell() and value() functions?

currently it looks like the cell handler blocks cell read alltogether. I am trying to read the cell contents and dump them into a database - the code was working fine for small spreadsheets; but now after the cell handler function, the table in the db comes out empty which obviously means the cell values are unable to be read.
any tips?

  • Comment on Re^2: Reading huge spreadsheets using Spreadsheet::ParseExcel...

Replies are listed 'Best First'.
Re^3: Reading huge spreadsheets using Spreadsheet::ParseExcel...
by jmcnamara (Monsignor) on Nov 12, 2010 at 09:54 UTC
    What do i do in the cell handler function so that i can read the cell contents using the get_cell() and value() functions?

    You don't need to use get_cell() since the cell_handler() callback function that you supply effectively replaces it.

    Once you have the cell object you can call value() (or any other method) on it in the same way you would with the standard interface. This is shown in the example that dasgar linked to:

    sub cell_handler { my $workbook = $_[0]; my $sheet_index = $_[1]; my $row = $_[2]; my $col = $_[3]; my $cell = $_[4]; # Do something useful with the formatted cell value print $cell->value(), "\n"; }

    --
    John.