First steps with Python so please be indulgent. I searched a lot, but it is not so clear to me where the error may be.
Accessing an excel file -> writing the sum into it -> re-read the value of the sum. I get =SUM(C3:N9) instead of the value, even with data_only=True
Any hint, please? Thank you in advance
# Load the sources of interest
import openpyxl
from openpyxl import load_workbook
# Open the document
excel_document = openpyxl.load_workbook('1.xlsx', data_only=True)
# Open the sheet of interest
sheet = excel_document.get_sheet_by_name('Foglio1')
# Read a cell of interest and print its content
cell_of_interest_1 = sheet['C4'].value
print cell_of_interest_1
#Ask a value to the user to be inserted for updating the cell of interest
valore1 = input ("Insert the new value for the cell :")
#The cell is updated with the user input
sheet['C4'] = valore1
#Insert the total sum of the values of the Sheet in cell P9
sheet["P9"] = "=SUM(C3:N9)"
# The value of cell P9
grand_sum = sheet['P9'].value
# Read and print the value of cell P9
print "Total sum of the Sheet values:"
print grand_sum
d = sheet.cell(row=9, column=16).value
print d
# Save the updated file
excel_document.save("1.xlsx")