访问数据在Excel - Reuter从python [英] Access data in Excel - Reuter from python
问题描述
我使用在Excel中集成的路透收回市场数据。对于任务自动化,我目前使用VBA,但现在我想切换到python。包 pyxll
没有什么帮助,因为原理是相同的VBA(我需要在Excel内,单击RUN按钮...)
我正在考虑使用win32com从外部访问Excel与COM对象。但是,当我这样做:
I'm using Reuters integrated in Excel to retrieve market data. For task automation , I currently use VBA but now I want to switch to python. The package pyxll
does not help much because the principle is the same as VBA (I need to be inside Excel and click on the RUN button...)
So I'm considering using win32com to access to Excel from outside with COM object. However, when I do:
from win32com.client import Dispatch
xlApp = Dispatch("Excel.Application")
此代码打开一个新的Excel实例,没有Reuter加载项不能使用Reuter函数来检索数据)。我不知道如何从python访问Excel-with-Reuter实例?
我已经看过 Com Explorer
来浏览服务,我没有看到任何其他服务比Excel
This code opens a new instance of Excel that does not have Reuter add-in in there (thus I can't use the Reuter function to retrieve data). I don't know how to access to Excel-with-Reuter instance from python?
I've taken a look at Com Explorer
to explore the service and I didn't see any other service than Excel
推荐答案
尝试此操作 -
import os
from win32com.client import GetObject
os.startfile(r'C:\path\to\ReutersExcel.exe')
xlApp = GetObject(None, 'Excel.Application')
这篇关于访问数据在Excel - Reuter从python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!