Perl script does nt parses d entire excel file please help

N

neo

The perl script does not parses d entire excel file.The problem is that
it just searches till d 9th record in the excel file.

the perl script


my $member = $FORM{'hiddenField'};
my $oExcel = new Spreadsheet::parseExcel;
my $oBook = $oExcel->Parse($ExcelFile);
my $chipcount=0,$drivercount=0;

#print("<div id=\"Layer9\" style=\"position:absolute; left:123px;
top:197px; width:654px; height:54px; z-index:15; overflow: hidden\">");
#print("<font size=3>hidden field is $member$member</font><br></div>");

# Read the excel file
foreach my $oWkS (@{$oBook->{Worksheet}})
{
defined $oWkS->{MaxRow};
for($i=1;$i<=$oWkS->{MaxRow};$i++)
{
if($oWkS->{Cells}[$i][$membername]->Value eq "")
{
next;
}
$fullname = $oWkS->{Cells}[$i][$membername]->Value;
if(index(lc($fullname),$member)!= -1)
{
#found the member
$outname = $fullname;
$outest = $oWkS->{Cells}[$i][$est]->Value;
$outtst = $oWkS->{Cells}[$i][$tst]->Value;
for($j=0;$i<=$oWkS->{MaxRow};$i++)
{
print("row $i name $fullname<br>");

$outdriver[$drivercount] =
$oWkS->{Cells}[$i][$driver]->Value;
if($outdriver[$drivercount] ne "")
{
$drivercount++;
}
if($i<$oWkS->{MaxRow})
{
if($oWkS->{Cells}[$i+1][$membername]->Value ne "")
{
last;
}
}


}
last;
}
else
{
print("row $i name $fullname<br>");
}
}
}




please help me out
 
M

Mumia W.

The perl script does not parses d entire excel file.The problem is that
it just searches till d 9th record in the excel file.

the perl script
[...]

What file? You didn't attach the excel file, so no one can
test your program with the data you're using. Perhaps you can
attach a /very small/ excel file that gives you the same
problem as the normal excel file.
 
P

Paul Lalli

Mumia said:
The perl script does not parses d entire excel file.The problem is that
it just searches till d 9th record in the excel file.

the perl script
[...]

What file? You didn't attach the excel file, so no one can
test your program with the data you're using. Perhaps you can
attach a /very small/ excel file that gives you the same
problem as the normal excel file.

No, no he can't. Attachments don't work in text-only newsgroups.

Paul Lalli
 
D

DJ Stunks

neo said:
The perl script does not parses d entire excel file.The problem is that
it just searches till d 9th record in the excel file.

"record"?? what's that mean - it never gets to the 10th row? or the
10th worksheet? or the 10th column?
my $member = $FORM{'hiddenField'};
my $oExcel = new Spreadsheet::parseExcel;
my $oBook = $oExcel->Parse($ExcelFile);
my $chipcount=0,$drivercount=0;

#print("<div id=\"Layer9\" style=\"position:absolute; left:123px;
top:197px; width:654px; height:54px; z-index:15; overflow: hidden\">");
#print("<font size=3>hidden field is $member$member</font><br></div>");

# Read the excel file
foreach my $oWkS (@{$oBook->{Worksheet}})
{
defined $oWkS->{MaxRow};

did you happen to notice

Useless use of defined operator in void context

here?
for($i=1;$i<=$oWkS->{MaxRow};$i++)

if it never gets to the 10th row, I'd investigate what value you get
for $oWkS->{MaxRow} and why. I don't know how MaxRow is determined.
{
if($oWkS->{Cells}[$i][$membername]->Value eq "")
{
next;
}
$fullname = $oWkS->{Cells}[$i][$membername]->Value;
if(index(lc($fullname),$member)!= -1)
{
#found the member
$outname = $fullname;
$outest = $oWkS->{Cells}[$i][$est]->Value;
$outtst = $oWkS->{Cells}[$i][$tst]->Value;
for($j=0;$i<=$oWkS->{MaxRow};$i++)
{
print("row $i name $fullname<br>");

$outdriver[$drivercount] =
$oWkS->{Cells}[$i][$driver]->Value;
if($outdriver[$drivercount] ne "")
{
$drivercount++;
}
if($i<$oWkS->{MaxRow})
{
if($oWkS->{Cells}[$i+1][$membername]->Value ne "")
{
last;
}
}


}
last;
}
else
{
print("row $i name $fullname<br>");
}
}
}
please help me out

instead of pleading, why don't you help us help you. tell us what your
script is or isn't doing that you want or don't want it to do. enable
strictures and warnings and modify your code as necessary until it runs
clean.

-jp
 
D

Dave Weaver

On 4 Aug 2006 01:42:17 -0700 said:
for($i=1;$i<=$oWkS->{MaxRow};$i++) ....
for($j=0;$i<=$oWkS->{MaxRow};$i++)

Apart from the fact that the 2nd statement should probably be using $j
instead of $i (as someone else pointed out), did you mean to start the
one loop from 1, and the other from 0? Looks a little odd to me.

This sort of thing is better written:

for my $i (1 .. $oWkS->{MaxRow})
...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top