Hello all. I have recently been porting OLE based perl scripts to a Unix environment and have hit a snag when dealing with Spreadsheet::ParseExcel. The module returns a maximum row of 2954 when some of the spreadsheets I need to parse are well above 5,000 rows.
I'm hoping someone knows of a fix or work around. I have tried ignoring the MaxRow but the module will not retrieve values beyond that point. I've also snooped around the module its self and I am unable to find this value hard coded in anywhere.
I am open (and grateful) for any unix compatable work around, but preferably perl. I am not sure what is dictating the row number cap and was surprised to find no results on google of people with similiar problems.
Update, this is some of the parsing code
for($r = $wks->{MinRow}; $wks->{MaxRow} && $r <= $wks->{MaxRow}; $ +r++) { if(cell($wks,$r,0) !~ /(group|category|project|client)/i) + { next; } if(cell($wks,$r,0) =~ /group/i) { $group= cell($wks,$r,1 +); next; } if(cell($wks,$r,0) =~ /category/i) { $category= cell($wks,$r,1 +); next; } if(cell($wks,$r,0) =~ /project/i) { $project= cell($wks,$r,1) +; $client= "0"; } if(cell($wks,$r,0) =~ /client/i) { $client= cell($wks,$r,1) +; }
# Utility function to safely look inside of a Cell sub cell { my ($Wks, $r, $c)= @_; if (defined $Wks->{Cells}[$r][$c]) { my $val= $Wks->{Cells}[$r][$c]->Value; $val =~ s/ \(/\(/gi; $val =~ s/formerly/Frm\./gi; $val =~ s/\s\s/ /gi; return $val; } return ""; }
Update 3 days later
One of the perlmonks was good enough to give me some code on his scratch pad that seemed to work, but now I have a WEIRD problem! Note the following code:
#!/usr/bin/perl -w use strict; use Spreadsheet::ParseExcel; my $parse_excel = Spreadsheet::ParseExcel->new(); my $workbook1= $parse_excel->Parse('data/DASNYFootnotes.xls'); print "Max row : ", 1 + ${$workbook1->{Worksheet}}[0]->{MaxRow +}, "\n"; my $workbook2= $parse_excel->Parse("data/dasnyFootnotes.xls"); print "Maxrow b: ", 1 + ${$workbook2->{Worksheet}}[0]->{MaxRow +}, "\n";
Gives the output
Max row : 3249 Maxrow b: 2955
and if I switch the order, maxrow b is still only 2955!!! I don't understand? They look identical
It was my own stupid fault! Some how two files had the same name with different case in my data folder! Sorry!
In reply to Spreadsheet::ParseExcel MaxRow is maxing out at 2954 by skelooth
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |