Python openpyxl reads float value incorrectly
09:27 06 Aug 2020

There is a cell in my Excel worksheet which contains the exact numeric value 708.143.

It is formatted as a number with 2 decimal places.

It is displayed as 708.14.

When I read this value in Python via the openpyxl library, the value retrieved is 708.1429999999998.

How do I retrieve the raw data value of 708.143?

This is a simplified representation of my code:

wb = openpyxl.load_workbook(filename, read_only = False, data_only = True)
ws = wb['blah']
range = ws['BS2' : 'BS289']
cell = range[20][0]
actual_value = cell.value # = 708.1429999999998
expected_value              = 708.143

Screenshot:

enter image description here

python excel openpyxl