2021年5月4日星期二

Registering an xll addin outside a loop

This code takes 6 minutes to do a few calculations looping over 2K xlsx files containing 39 X 10 cells of stock fundamentals data. I would like to know if it could be speeded up by registering the xll addin before the beginning of the loop. If I manually run stock after stock I don't have to keep reinstalling the addin.

import xlwings as xw    app = xw.App(visible=False)  # ?Workaround possible to place registration here  stocks = next(os.walk(path5))[2]  for stock in stocks:      wb = xw.Book(path5 + stock)      wb.app.api.RegisterXLL('C:/Users/Owner/AppData/Roaming/Microsoft/AddIns/vsoft15.xll')      ws = wb.sheets[0]      // do stuff  
https://stackoverflow.com/questions/67394688/registering-an-xll-addin-outside-a-loop May 05, 2021 at 11:07AM

没有评论:

发表评论