在 Excel 中访问数据 - 来自 python 的路透社 [英] Access data in Excel - Reuter from python

查看:35
本文介绍了在 Excel 中访问数据 - 来自 python 的路透社的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Excel 中集成的路透社来检索市场数据.对于任务自动化,我目前使用 VBA,但现在我想切换到 python.pyxll这个包没有多大帮助,因为原理和VBA一样(我需要在Excel里面点击RUN按钮...)所以我正在考虑使用 win32com 从外部通过 COM 对象访问 Excel.但是,当我这样做时:

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	oReutersExcel.exe')
xlApp = GetObject(None, 'Excel.Application')

这篇关于在 Excel 中访问数据 - 来自 python 的路透社的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆