Refresh Excel External Data with Python

CalculateUntilAsyncQueriesDone() will hold the program and wait until the refresh has completed.

xlapp = win32com.client.DispatchEx("Excel.Application")
wb = xlapp.Workbooks.Open(<path_to_excel_workbook>)
wb.RefreshAll()
xlapp.CalculateUntilAsyncQueriesDone()
wb.Save()
xlapp.Quit()

Leave a Comment