in reply to Out of Memory

For what it's worth, we hit exactly the same problem yesterday: ie. realising that Spreadsheet::XLSX just isn't fit for purpose with large files.

On looking at the XLSX.pm code, it became clear it's all a bit of a hack (as noted in various posts above): XML is not parsed properly, inefficient use of regexes, apparent problems with extracting special chars ... even if all that worked OK, it then tries to write the entire spreadsheet in-memory into a Spreadsheet::ParseExcel::Workbook object, which itself would slurp up huge amounts of memory, if it managed to get that far.

To be fair to the author, he does describe the module as "quick and dirty", and I guess that's the down-side of CPAN: production-quality is not guaranteed. Lesson we've learnt: when assessing that module originally, we should've tested it on a large file up front. Doh.

So, first we're going to test 'SimpleXlsx' (which is also on CPAN) to see if that's any better: not yet tried, but it does claim to parse the XML properly. And if that's no good, we're going to have to roll our own.

Replies are listed 'Best First'.
Re^2: Out of Memory
by oxone (Friar) on May 06, 2011 at 15:13 UTC

    For the record: 'SimpleXlsx' now checked, and no better on big files. So, it seems there is no module on CPAN which can parse a large XLSX file :-(

    Will need to write a better version then, unless OP has already found a solution?