Skip to content Skip to sidebar Skip to footer

Python Using Win32com Wont Update Excel Sheet With Needed Add-ins

I am trying to get a python script to create an excel file with a formula ready to be executed when the workbook opens(it requires an add-in only available in excel). Once open, ex

Solution 1:

xlapp = win32com.client.DispatchEx("Excel.Application")
xlapp.RegisterXLL('C:/blp/API/Office Tools/bofaddin.dll')
xlapp.Workbooks.Open('C:\\blp\\API\\Office Tools\\BloombergUI.xla')
wb = xlapp.Workbooks.Open(filepath,None,False)
xlapp.Visible = True
wb_addin = ('C:/blp/API/Office Tools/bofaddin.dll')
wb.RefreshAll()
sleep(60)
wb.Save()
xlapp.Quit()

Here is the working code.

Solution 2:

I believe the Bloomberg API in Excel needs both the .dll and the xla. Try adding:

xlapp.Workbooks.Open('C:\\blp\\API\\Office Tools\\BloombergUI.xla')

I didn't want to test your code for fear of hitting my monthly data limit, but your RegisterXLL was the key to solving my issue.

Post a Comment for "Python Using Win32com Wont Update Excel Sheet With Needed Add-ins"