On 2012.06.05.17.19, Ken Furff wrote:
> for my $row (1..$row_max){
> ...
> $worksheet->write ($row+1, 0, "$valA");
> $worksheet->write ($row+1, 1, "$valB");
> ...
> for some reason it puts the values in the new worksheet on the row
> that it finds them on in the original. So the spreadsheet is 3700
Yep, problem makes sense. Here you're looping over the original sheet
using $row to be the current row. Then you're using that same one to
write to the new sheet.
Instead, you should keep a $write_row variable. Start it off at 1, and
then increment it each after you do the above writes. So:
my $write_row = 1;
for my $row (1..$row_max){
# ...
$worksheet->write ($write_row, 0, "$valA");
$worksheet->write ($write_row, 1, "$valB");
$write_row++;
# ...
}
See if that helps,
--Brock
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/