I am using Anaconda 64x (Python v.2.7) and openpyxl==2.2.4 I open an xlsx file with openpyxl read_wb = openpyxl.load_workbook(z)
Playing with it, cells values and formula get out just fine: so far so good.
Then when I save the file I get the 'classic' discarded range with reserved name prompt (looked at the user forum of openpyxl)
UserWarning: Discarded range with reserved name
warnings.warn("Discarded range with reserved name")
Looking at the saved file, it lost some 300k in weight compared to the original.
Opening up the saved file, I get an error message that some content needs to be repaired
Excel does what it can and of course the file ends up badly messed up
Now I traced back the calculations down to a missing name range called 'tR' which is an empty single cell
Curiously enough, I call on openpyxl to get me 'tR' properties with
print read_wb.get_named_range('tR') I get:
Uhm, no figure, no number, just !$A
So then I unzipped the .xlsx, went into \xl\workbook.xml to check it out:
<definedName name="tR" localSheetId="3">Depreciation!$A1</definedName>
Then the name manager in Excel tells me that tR refers to Depreciation!$A7 !!!!
So it seems that something low level overrides the instruction of workbook.xml, but despite looking at all the xml files one by one I cannot figure out what...