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.


In reply to Re: Out of Memory by oxone
in thread Out of Memory by ETLTCHFIG

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.