Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^3: WriteExcel and formulas

by jmcnamara (Monsignor)
on Jul 26, 2012 at 09:33 UTC ( #983809=note: print w/ replies, xml ) Need Help??


in reply to Re^2: WriteExcel and formulas
in thread WriteExcel and formulas

Is that a problem with the viewer or the module?

A little bit of both.

Spreadsheet::WriteExcel writes formulas in the required binary RPN format but it doesn't write the result of the formula since it wouldn't be practical to calculate the result of arbitrary formulae. So instead it writes 0 as a default formula result. Excel and most other spreadsheet applications recalculate the result of formulas when the file is loaded so that generally isn't an issue.

However, Excel Viewer doesn't calculate formulae so all you see is the default 0 result.

You can work around this by explicitly specifying the calculated value of the formula at the end of the argument list:

$worksheet->write_fromula('A1', '=2+2', $format, 4); # Or: $worksheet->write('A1', '=2+2', $format, 4);

--
John.


Comment on Re^3: WriteExcel and formulas
Download Code
Re^4: WriteExcel and formulas
by rohit_raghu (Acolyte) on Jul 27, 2012 at 05:02 UTC
    Thanks,

    I discovered another way by accident. Simply open the file on a system with excel and save it. MS Excel recalculates formulas in files last saved by an earlier version of excel.

    Rohit Raghunathan

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://983809]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (9)
As of 2014-09-30 11:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (364 votes), past polls