eikon data on excel not working when launched with python

Hi,


I have an excel file with eikon formulas and macros to update spot, swap points and do some math etc... I would like to launch that excel file using Python and execute the excel's macros also with Python. Manually everything works but when I use Xlwings or win32com to launch the excel with python, the dates are 00/01/1900 and every FX spot is at 0 and when I try to refresh manually or with python nothing works.

The Add in is connected and I am logged in so it should work.


My python script works when I open and run macro on excel that do not use eikon data.


import xlwings
import time

def run_macro (work_book_path: str, *args: str):
"""Run macro from a workbook

Args:
work_book_path (str): macro's name
"""
wb = xlwings.Book(work_book_path)

time.sleep(10)

for macro in args:
print(f"running {macro}")
running_macro = wb.macro(macro)
running_macro()
time.sleep(3)

run_macro(PATH_UMILP_P2,
"Module1.macro1",
"Module1.macro2",
"Module1.macro3",
"Module1.macro4"
)

Best Answer