-1

I'm using openPyXl library and I'd like to store a cell value, not its formula. In the cell that I want to read there's the formula

=COUNTIF(C4:C21,"M")

and it returns 0, but when I read it from python

read=sheet['C28'].value

it returns me again =COUNTIF(C4:C21,"M"). And if i try with simply

read=sheet['C28']

It returns me

<Cell 'Sheet1'.C28>

How could I get 0?

Thank you

L0dz
  • 25
  • 1
  • 6

1 Answers1

6

According to How to access the real value of a cell using the openpyxl module for python when loading the workbook you have to set data_only to True: wb = load_workbook("file.xlsx", data_only=True)

Michael Cox
  • 1,116
  • 2
  • 11
  • 22