1

I have this simple python script:

from openpyxl import Workbook

book = Workbook()
sheet = book.active

sheet["A1"]=3

sheet["A2"]=4

sheet["A3"]="=SUM(A1:A2)"

book.save("k_test.xlsx")   

When I open the excel sheet A3 is empty (not calculated). If have to click on the cell and press enter - then the value appears. How can I force excel to calculate the values?

ger.s.brett
  • 3,267
  • 2
  • 24
  • 30

1 Answers1

1

In case anyone runs into the same problem. There were two issues:

  • as I was starting from a non English Excel version, I forgot to translate one command to English. So it showed up right lateron in Excel, but there had been an internal error in between that kept it from evaluating it.
  • I had references to an Excel tab that did not exist at the time of inserting the formula. This also leads to the problem that it cannot be evaluated. I had to add the referenced tab, before I could add the formula referring to it.
ger.s.brett
  • 3,267
  • 2
  • 24
  • 30