Because I need to parse and then use the actual data in cells, I open an xlsm in openpyxl
with data_only = True
.
This has proved very useful. Now though, having the same need for an xlsm that contains formuale in cells, when I then save my changes, the formulae are missing from the saved version.
Are data_only = True
and formulae mutually exclusive? If not, how can I access the actual value in cells without losing the formulae when I save?
When I say I lose the formulae, it seems that the results of the formulae (sums, concatenattions etc.) get preserved. But the actual formulaes themselves are no longer displayed when a cell is clicked.
UPDATE:
To confirm whether or not the formulaes were being preserved or not, I've re-opened the saved xlsm, this time with data_only
left as False
. I've checked the value
of a cell that had been constructed using a formula. Had formulae been preserved, opening the xlsm with data_only set to False should have return the formula. But it returns the actual text value (which is not what I want).