问题
I want to update value in excel and get new updated value of output cell in excel using OpenPyXL in python 3
Below is code
import openpyxl
xfile = openpyxl.load_workbook('sheet.xlsx')
sheet = xfile.get_sheet_by_name('Sheet1')
print (sheet['D2'].value)
sheet['A2'] = 3
print (sheet['D2'])
xfile.save('sheet.xlsx')
and below is sample data in excel : Image of excel file
and below is output I am getting
python3 xl.py
=SUM(A2:C2)
<Cell 'Sheet1'.D2>
How can I get value of this cell as calculated after application of formula (=SUM(A2:C2) in this case ).
来源:https://stackoverflow.com/questions/45949630/getting-formula-while-reading-cell-data-in-openpyxl