I am using win32com.client to open Excel with
excel = win32com.client.Dispatch("Excel.Application")
workbook = excel.Workbooks.Open(filename,UpdateLinks=False, ReadOnly=True)
Sometimes this generates an alert with the following text:
"This workbook contains one or more links that cannot be updated." & options are: "Continue", and "Edit Links").
This stops the script until I handle the dialogue box manually which is not preferred.
I want to continue as if "Continue" had been clicked, or to suppress the whole dialogue box, I can't find a way to do this.
Searching the Stackoverflow forums, I've seen the following suggestions:
excel.DisplayAlerts = False
excel.AskToUpdateLinks = False
I've tried each of these (immediately after the excel variable is assigned) and neither has the desired effect, separately or together.
As suggested in other forums I have also tried to open excel & save & then again reopen with python, which is also not working.
wb = xlApp.Workbooks.Open(Path to file,UpdateLinks = False)
ws = wb.Worksheets('XYZ')
wb.Close(SaveChanges=1)
excel.Visible = False
excel.ScreenUpdating = False
excel.DisplayAlerts = False
excel.AskToUpdateLinks = False
wb = xlApp.Workbooks.Open(Path to file)
ws = wb.Worksheets('XYZ')
Does anyone know a solution that works? anything will do either break link or continue. Thank you in advance
excel.AskToUpdateLinks = False
As far as I know, the above turns off the prompt and automatically update external links as a file is open. Try use below:
excel = win32com.client.Dispatch("Excel.Application")
excel.DisplayAlerts = False
workbook = excel.Workbooks.Open(Path to file,UpdateLinks=0)