Values not preserved when reading formulae

Issue #239 resolved
Adam Morris
created an issue

Currently only formulae are saved when reading worksheets.

For most cases this makes sense, as there is no mechanism to calculate formulae within openpyxl, and excel re-calculates empty formulae once the excel files are reloaded.

However, one use of openpyxl is to retrieve data from excel files, in which case having the value is what's needed.

This came up in: https://groups.google.com/forum/#!topic/openpyxl-users/g3PQIpqzBnA

I know there have been a few other discussions on this, but not sure on the consensus:

https://bitbucket.org/ericgazoni/openpyxl/issue/177/data_type-of-rawcell-wrong-in-one https://groups.google.com/forum/#!searchin/openpyxl-users/formula$20value/openpyxl-users/KV8cm8cRf4E/EZvarxjZC9kJ

I propose a simple mechanism, adding the cached values to a dictionary on the worksheet (not in the cell). This way, the values are accessible when needed, but otherwise don't add to the cell complexity. It doesn't need to be written, as excel will re-calculate.

Comments (1)

  1. Log in to comment