My code is below. BUt i am getting error
xlapp = win32com.client.gencache.EnsureDispatch("Excel.Application")
xlapp.Interactive = False
xlapp.Application.EnableEvents = False
xlapp.DisplayAlerts = False # Suppress any Alert windows, which require User action
xlapp.AskToUpdateLinks = False # Disable automatic update linking
xlapp.Visible = False # Run the Application in the background
pathname = os.path.dirname(destination_file)
path = os.path.abspath(pathname) + '\\'
out_file = path + destination_file
print(f"The outfile path is {out_file}")
# Open the workbook in said instance of Excel
wb_7 = xlapp.workbooks.open(out_file)
# Refresh all data connections.
wb_7.RefreshAll()
xlapp.CalculateUntilAsyncQueriesDone()
wb_7.Save()
wb_7.Close(True)
wb_7 = None # Unset wb_7 variable (This is to ensure it's closed)
xlapp.Interactive = True
xlapp.DisplayAlerts = True # Suppress any Alert windows, which require User action
xlapp.AskToUpdateLinks = True # Disable automatic update linking
xlapp.Application.EnableEvents = True
xlapp.Visible = True # Run the Application in the background
xlapp.Quit() # Close Excel
i am getting the below error... couldnt able to get what i need to fix here i need some suggestion
raise AttributeError("'%s' object has no attribute '%s'" % (repr(self), attr))
AttributeError: '<win32com.gen_py.Microsoft Excel 16.0 Object Library._Application instance at
0x2584370933424>' object has no attribute 'workbooks'