I'm automating some excel related tasks which take a long time.
I'm creating an excel instance using:
excel = win32.gencache.EnsureDispatch('Excel.Application')
wb = excel.Workbooks.Add()
however, after the script starts running, if i select an open excel workbook(not the one python is working on), The python script crashes. However, if I open a new excel workbook and type stuff into it, the python script is unaffected.
Is there a particular way I can call excel to prevent this from happening? Or any other solution?
EDIT: This seems to work.
excel = win32.DispatchEx('Excel.Application')