Write formula to a cell, Excel destroys when opening

Issue #1178 closed
Lucas Ribeiro created an issue

Trying to write to a cell the following formula:

ws['I2'].value = '=SE(G2>F2;1;0)'
print (ws['I2'].data_type)

prints the data_type as 'f', but the cell is destroyed when trying to open it in Excel 2016 (PT-BR). Writing the formula as IF instead of SE wields the same result. Forcing the type with:

ws['I2'].data_type = 'str'

Makes the cell visible in Excel, but it is not evaluated yet. You have to click the cell and press enter to evaluate.

Here are the cell attributes inside the xml: before forcing the data type:

<c r="I2">
    <f>IF(G2>F2;1;0)</f>
    <v/>
</c>

after forcing the data type to 'str', before clicking to evaluate:

<c r="I2" t="s">
    <v>71888</v>
</c>

after clicking to evaluate:

<c r="I2">
    <f>IF(G2>F2,1,0)</f>
    <v>0</v>
</c>

Is this a language bug? Reminding that I tried both methods, IF and SE.

Comments (5)

  1. Log in to comment