I'm trying to compute data from some excel files by using the library openpyxl
.
And am now in trouble with the cell.value of functions or equations.
eg:
I may have such two cell.value
below:
ws = openpyxl.load_work(xl_path)['Sheet1']
print(ws['B1'].value)
print(ws['B2'].value)
[output:]
= A1+A2 # Actually, the true value may be 1(A1) + 2(A2) -> 3
= A2*A4 # Actually, the true value may be 1(A1) * 4(A4) -> 4
And when I compute it , I got is not what I want:
ws['C1'].value = ws['B2'].value + ws['B1'].value
print(ws['C1'].value)
I got a string result that concat str format
value of this two cell.value:
[output:]
= A1+A2= A2*A4
I know some methods to get the true value of cells not functions or equations by using some 3rd party library , such as pandas
.
But I wanna search a way just use the openpyxl
.