Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SaveParser overwriting existing formulas

Status
Not open for further replies.

asj75

Programmer
Joined
Jan 11, 2006
Messages
6
Location
CA
I have an existing excel file and need to write to it on a daily basis.
The excel file comes with functions and when I use
ParseExcel::SaveParser, the formulas are no longer showing up.
Is there anyway to maintain the formulas?
 
Is it overwriting cells automatically, even ones you're not adding to?

Have you tried writing the formula to a cell in the row
="=sum(".$activerow.", 2:".$activerow.", 6)";

I'm just clutching here? ;-)

--Paul

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
The function in the excel file is to extract day from a date. The parseexcel::saveparser would open the existing excel file and write to the appropriate different cell based on the date.
I have read somewhere that parseexcel::saveparser overwrites pre-existing functions but haven't found a way to force the function/calculation to stay.
 
Just write the formula to the cell as described above, assuming you have the correct row index to include in the formula
Code:
Cell("A3)="=...";
No?

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
This is how the function was done when I was creating the excel file using WriteExcel.

my $str = xl_rowcol_to_cell(5, $col);
$worksheet->write(4,$col,'=TEXT('.$str.',"dddd")');
$worksheet->write(5,$col,$mth.'/'.$isheet.'/'.$full_year);

So I would write the formula as you have given in the WriteExcel script itself?

BTW, thanks for helping me out with this - been driving me nuts - could be because I am so new to Perl.

 
That might do it, and you're welcome, I'm just killing time till the pubs start rocking;-)

$worksheet->write(4, $col, '=sum('.$col-1,$row.":".$col-4,$row.")");

should render a formula in the cell
Code:
+----------+
[SUM(XX:YY)]
+----------+



Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Doesn't seem to work. It seems that SaveParser just defaults the calculation cell to 0.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top