Skip to content Skip to sidebar Skip to footer

How To Get Value Of Cell Instead Formula Value?

I use this library openpyxl. And read data as: for row in sheet.rows: print row[0].value Instead value of cell I get formula: =D42-D42*0.1.

Solution 1:

Edit: In latest version (3.0.6+) the api was changed to disable the user of the first option (internal_value property) and thus only the second option now works. (Thanks Akshat)

You can either

  1. Use row[0].internal_value.

Or

  1. Use data_only=True when you load your workbook. (For example, workbook = openpyxl.load_workbook("yourxlsx.xlsx", data_only=True))

The second option is good when you are sure you don't wish to ever get the original formula from the workbook.

Post a Comment for "How To Get Value Of Cell Instead Formula Value?"