I have a problem when I'm trying to save and than read excel file in python. So this is my function:
import openpyxl
import xlrd
from xlutils.copy import copy
import pandas as pd
def write_excel():
wb = openpyxl.load_workbook('8de69ccb60047ce5.xlsx')
sheet = wb.active
sheet['D18'] = 3
wb.save('8de69ccb60047ce5.xls')
df1 = pd.read_excel('8de69ccb60047ce5.xls', sheet_name='Лист1', header=None, skiprows=1, usecols="H,I")
print(df1)
workbook = xlrd.open_workbook('8de69ccb60047ce5.xls')
worksheet = workbook.sheet_by_index(0)
print(worksheet.cell(17, 8).value)
print(worksheet.cell(18, 8).value)
I'm changing cell D18, saving file and than trying to read other cells that has formulas but I get nothing (also cell without formulas read correctly).
But if I open file manually and save it in Excel that lines of code read those cells correctly.
The problem is this line wb.save('8de69ccb60047ce5.xls'). It saves changes in file but it doesn't saves file correctly (I don't know how to discribe it). How can I read cell with formula after changing the file in python?