'Refresh excel in python error, pywin, win32com
So I have this code that refreshes an excel workbook that was working, until I was messing around with another way to refresh the workbook. This is the code that was working for 6 months up until yesterday. Any help would be great as this unfortunately is for work. Also is there a better / more consistent way to refresh excel files? Thanks.
import win32com.client
import pythoncom
import time
pythoncom.CoInitialize()
xlapp = win32com.client.DispatchEx("Excel.Application")
xlapp.Visible = False
wb = xlapp.Workbooks.Open("workbookpath.xlsx")
time.sleep(2)
wb.RefreshAll()
xlapp.CalculateUntilAsyncQueriesDone()
time.sleep(5)
wb.Save()
wb.Close(SaveChanges=1)
xlapp.Quit()
wb = None
xlapp = None
TypeError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_19060/2575575353.py in <module>
9 xlapp.CalculateUntilAsyncQueriesDone()
10 time.sleep(5)
---> 11 wb.Save()
12 wb.Close(SaveChanges=1)
13 xlapp.Quit()
TypeError: 'bool' object is not callable
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
