Is there any way to get both the cell formula and the cell value in the same load of the file in openpyxl?
Currently I have had to do the following:
wb_data_only = load_workbook(filename=file, data_only=True, read_only=True)
wb_formulas = load_workbook(filename=file, data_only=False, read_only=True)
And then I have to loop over the both these objects linearly in order to get the formula and value. For e.g. to get the data values only I do this:
for sheet in wb_data_only:
for row in sheet.iter_rows():
cell in row:
return cell.value
And then I have to repeat the same on the formula object.
Is there a more efficient way?