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

You might want to check out the Reducing the memory usage section of the documentation for Spreadsheet::ParseExcel to see if that information might help you to modify your code in order to dodge the memory usage issue.

(Of course, the author is an active user on Perl Monks and he might respond with more information and/or tips at some point.)

The only alternative that I can think of would be to use Win32::OLE on a Windows system that has Excel installed.

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

Replies are listed 'Best First'.
Re^2: Reading huge spreadsheets using Spreadsheet::ParseExcel...
by biswanath_c (Beadle) on Nov 11, 2010 at 22:16 UTC
    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?

      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.