Excel live data extraction

I am trying to read the live data from excel file.

wb = openpyxl.open("C://users//pandian//Desktop//Index.xlsx", data_only=True, keep_links=True)
sh = wb.active
c1 = sh["E2"].value
c2 = sh['F2'].value
c3 = sh['C2'].value
c3 = sh.cell(row=2,column=3).value

print("Value of the Cell 1:",c1)
print("Value of the Cell 2:",c2)
print("Value of the Cell 3:",c3)

I am not getting the updated value. It’s always previously saved value.
How to extract the live data ?

When you say “live data”, do you mean data that has been entered, but not saved? If so, I don’t know that you can do that; you can only (so far as I know) read the data from a saved file.

Thanks. Yes, Its live feed from stock market.

Okay, well the obvious question is: how is the data getting into the spreadsheet? My guess is via some API, in which case why can’t you simply use said API directly, rather than via the spreadsheet?

If that’s not an option, the only other thought I have is to auto save the spreadsheet on a time frame that matches (as close as possible) to the stock market time frame and code your Python with a update delay of the same value, plus some margin of error. I did something like that myself, but the update was every hour, so the timing was easy to do, but even every minute would not be too hard to sync.

Thanks for your prompt reply. The data is not from API, Its streaming data from broker terminal and has the option to link it to excel. The update is every second. Now the question is whether the excel file can be saved each time by python before retriveing it.

I hope the following post will help you.

I like pywin32 (6th answer), which helps me in my daily work.

It maybe worthwhile to discover how said link works, as you may be able to hook into that.

The Excel software has an auto save option, but 1 second is far too granular. I’m not a user, but I have used Excel in past years and I think the auto save has a minimum time frame of one minute.