How to integrate Excel =RTD() function in python

2019-09-08 09:09发布

问题:

I am using a real-time-data from a proprietary application which provides real time weather data. All I know know from the data is, it provides a link to import to excel as:

=RTD("4cast.wetter",,"city","parameter") This parameter includes Temperature, Humidity, Wind speed, Rain fall etc.

I tried reading the support link provided at excel documentation but couldn't get if it could be used with Python. http://support.microsoft.com/kb/289150

So now my real purpose is to use this Data received by RTD function in excel directly in Python.

As said in RTD documentation, "call a Component Object Model (COM) Automation server to retrieve data in real time" Is there a midway to integrate this COM server with Python?

Thank you.

回答1:

From the link which you have provided it seems that Microsoft has provided a wrapper for VBA(but not for Python).

I would suggest to check with the data provider if he offers an API to Python. This has nothing to do with Excel, but it would allow you to receive data directly into Python.

Another option is to receive data in Excel using RDT and use something like xlwings module http://xlwings.org/ to get data from Excel to Python.



回答2:

You can stream real time data into Excel as an RTD function using PyXLL.

See https://www.pyxll.com/docs/userguide/rtd.html for details, or have a look at this article that shows how to stream live tweets into Excel with Python https://www.pyxll.com/blog/a-real-time-twitter-feed-in-excel/