Python win32com Refinitiv COMAddin not showing

I am struggling to use Refinitiv COMAddin programmatically on excel using python win32com (I have also tried with xlwings with no success).

If I open excel manually an excel file the "Refinitiv" tab works perfectly fine but it appears to crash when I open excel indirectly from python: this creates issues when I am trying to insert refinitiv api formulas in cells.

I have looked at this other post https://community.developers.refinitiv.com/questions/29464/launch-excel-com-add-in-with-python-win32com.html but it does not work for me since the following command prompts an error:

xlapp.COMAddIns("PowerlinkCOMAddIn.COMAddIn").Connect = True

The code snippet I am using is the following

import win32com.client as win32
xlapp = win32.gencache.EnsureDispatch('Excel.Application')
xlapp.RegisterXLL(addin_path)
xlapp.Visible=False
wb = xlapp.Workbooks.Open(xlsPath,None,False)
sht = wb.Sheets('Sheet1')
sht.Cells(1,1).Value = formula_string


Where

formula_string: string containing the Refinitiv formula
xlsPath: path of the excel file I am opening
addin_path: path of the Refinitiv addin, which in my case is contained in  ...\AppData\Local\Refinitiv\Refinitiv for Office\1.19.98\Office_x64\refinitiv-shim.dll

Can anyone help me with this problem?

Thanks



Best Answer

Answers

  • Jirapongse

    thank you for the complete answer and the very useful links you provided.

    Unfortunately, the example you gave does not work on my machine, since the line:

    xlapp.COMAddIns("PowerlinkCOMAddIn.COMAddIn").Connect = True

    trigger an error on my console:

    "This addin is installed for all the users and can be connected/disconnected only by an administrator"

    The point is that I am currently an admin on my machine, and even launching python as administrator, I get the very same error, which is kind of confusing to me.

    --------------------------------------------------------------------------------

    In the meantime I would like to add another question which came to my mind after reading your links.

    The refinitiv-dataplatform python package (https://pypi.org/project/refinitiv-dataplatform/) basically replicates what can be done in excel using the addin on the button below

    1673604639492.png


    Is there any similar official python package for the Datastream part of the ribbon, as below?

    1673604700291.png

    Thank you

  • @bartolacci

    Yes, the Refinitiv Data Library for Python (https://pypi.org/project/refinitiv-data/) can retrieve fundamental data, real-time data, and time-series data which is similar to Eikon Excel Addin (Formula Builder).

    For the Datastream formula, you can use DatastreamPy (https://pypi.org/project/DatastreamPy/)