I am trying to build a tool which will run an index match in a cell on a spreadsheet, and then display the result of the formula in python. My understanding is Openpyxl will not actually run the formulas but I can write to excel and then refresh the file to run it?
from openpyxl import load_workbook
path= "C:\\Users\\Me\\Documents\\Python\\File.xlsx"
myworkbook=load_workbook(path)
worksheet=myworkbook.get_sheet_by_name('Sheet1')
mycell=worksheet['B2']
mycell.value="index(B4:B72,match(B1,A4:A72,0))"
print(mycell)
Anyway, I receive and error and I am not sure what is going on. Ouput:
DeprecationWarning: Call to deprecated function get_sheet_by_name (Use wb[sheetname]). worksheet=myworkbook.get_sheet_by_name('Sheet1')
Process finished with exit code 0
To be clear, the formula works if I just do it in Excel because B1 is populated in the file.
I am not sure what the output is doing. It is not throwing an error but I have no idea what <Cell 'Sheet1'.B2>
and "Process Finished with Exit code 0" is trying to tell me. I expected a string output because the I am trying to index in a sentence.