Hello my code-friends,

I am trying to make Perl read xls files and save them as a tsv .txt file(wich will be target of many checks, reads and at last transfer to mysql). But I am having a hard time with worksheets bigger than 5 thousand lines. With them the script just crashes and stops answering - with the others it goes ok, even that it is not fast at all.

Anyone of you has experience with large data manipulation in this task? Does the module in fact have this problem? Hereīs my code:

my $oExcel = new Spreadsheet::ParseExcel; my $file = "test4.xls"; my $oBook = $oExcel->Parse($file); my($iR, $iC, $oWkS, $oWkC); my @thisrow; # to store the row for latter processing # just the first worksheet $oWkS = $oBook->{Worksheet}[0]; for ( $iR = $oWkS->{MinRow} ; defined $oWkS->{MaxRow} && $iR <= $oWkS->{MaxRow}; $iR++) { @thisrow = (); for ( $iC = $oWkS->{MinCol}; defined $oWkS->{MaxCol} && $iC <= $oWkS->{MaxCol}; $iC++) { $oWkC = $oWkS->{Cells}[$iR][$iC]; if ($oWkC) { push (@thisrow, $oWkC->Value); print $thisrow[0]; # this last one ir just to test; here would # go the print to the .txt file handler } } }

I also know that I could use the unix shell to do that, but I asked the guys at my host and they said they never heard of a command line converter for that. Donīt know if it was the guy that didnīt know, or that itīs realy absent there...

Thanks a lot,

André


In reply to Spreadsheet::ParseExcel crashes above 5K lines by Andre_br

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.