import xlwt
wb = xlwt.Workbook()
sheet = wb.add_sheet('SHEET1')
#that value I want to get in my fu
sheet.write(0, 0, xlwt.Formula('E4*H8')) # for example value == 4
def fu(value):
x = value + 1
return x #How I can get 5 in answer
fu(???)
wb.save('E:/')
Good day. How can i get the value of the cell (0, 0), before I save the file and use it(int or float) in my function. Or I must save the file and open it with xlrd, get the value, and after then open file to run my function?
Reading stackoverflow I found the answer from autor of xlrd & xlwt: The modules can't read the formulas. Solution is count values in python and then write it on new cells:
x = 2
y = 2
sheet.write(0, 0, x*y)
c = x*y
def fu(c):
z = c+1
sheet.write(1, 1, fu(c))