There are a number of solutions to get the value from an Excel cell. It all depends on the environment you are in to get the evaluated cell value.
If you have used Excel to create the xls or xlsx file usually there's a value in a cell. It's not guaranteed because it is possible to turn off re-calc on save, but is usual. And, if someone has turned off re-calc on save the value may not be correct.
If the xls or xlsx file has been created by a non-Excel library (eg; openpyxl, xlwrt), unless you've expressly set the value of the cell, it may not have one.
Thanks to the Python universe there are options.
Pycel, xlcalculator, DataNitro, Formulas and Schedula can read an Excel file and evaluate the formula for a cell. None of these solutions need Excel installed. Most are likely to be OS independant.
- I can't find a datanitro link
disclaimer: I am the project owner of xlcalculator.
An example using xlcalculator:
from xlcalculator import ModelCompiler
from xlcalculator import Model
from xlcalculator import Evaluator
filename = r'output.xlsx'
compiler = ModelCompiler()
new_model = compiler.read_and_parse_archive(filename)
evaluator = Evaluator(new_model)
val1 = evaluator.evaluate('Sheet1!C5')
print("value 'evaluated' for Sheet1!C5:", val1)