PerlSufi has asked for the wisdom of the Perl Monks concerning the following question:
In the for loop, I am trying to repeat the formula for column G. It is doing it for all the cells in column G except G2. I tried incrementing from 1 in the for loop, taking away 1 in $line + 1, etc.. So the formula only starts repeating at G3, not G2. Any insight, as usual, is greatly appreciated. :)use strict; use warnings; use Spreadsheet::WriteExcel; use DBI; my $file = "/path/to/file/"; my $xWB = Spreadsheet::WriteExcel->new($file); my $xWS5 = $xWB->add_worksheet('Summary'); my $format = $xWB->add_format(); $format->set_bold(); #DBI stuff here.. my $row_count = $sth->rows; my $multiply = $xWS5->store_formula("=E2*F2"); # write worksheet my $rowz = 0; my $colz = 0; $xWS5->write($rowz,$colz++, $_) for @{$sth->{NAME}}; while (my $ar = $sth->fetchrow_arrayref) { ++$rowz; $colz = 0; $xWS5->write($rowz, $colz++, $_) for @$ar; for my $line (0..$row_count) { #this arguments are row, column, formula, format, first cell, second c +ell $xWS5->repeat_formula($line, 6, $multiply, $format, "E2", 'E'.($l +ine + 1), "F2", 'F'.($line + 1)); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Missing first row with formula
by hdb (Monsignor) on Jan 10, 2014 at 07:33 UTC | |
by PerlSufi (Friar) on Jan 10, 2014 at 15:03 UTC | |
|
Re: Missing first row with formula
by erix (Prior) on Jan 09, 2014 at 22:57 UTC | |
by Kenosis (Priest) on Jan 10, 2014 at 07:29 UTC |