Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python reads only the formula from excel cell

I have a excel 2010 file which has cells (See C2 below in formula bar) with formulae. (Screenshot 1 below)

enter image description here

I am reading the value using python and it's printing the formula instead of actual value of the cell (Screenshot below of eclipse console.)

enter image description here

I want the results to print 10.188.11.184 which is the value populated by the formula of the excel cell. How can this be achieved? Thanks in advance.

like image 573
santoshaa Avatar asked Dec 19 '22 03:12

santoshaa


1 Answers

From: https://openpyxl.readthedocs.org/en/latest/usage.html#read-an-existing-workbook

data_only controls whether cells with formulae have either the formula (default) or the value stored the last time Excel read the sheet.

wb = load_workbook('file.xlsx', data_only=True)
like image 62
Eric Levieil Avatar answered Jan 01 '23 14:01

Eric Levieil