This simple code is not working. I'm sure that the filepath is correct, but it seems that the problem is coming from a failure to open/add the workbook with the "Workbooks.Add" function. Here's the code:
from win32com.client import Dispatch
#processing the results
excel = Dispatch('Excel.Application')
excel.Workbooks.Add('C:\\Documents and Settings\\dell600\\My Documents\\Webscraping Output\\Results\\Processed Results.xls')
excel.Run('Apply_Process')
excel.DisplayAlerts = 0
excel.Quit()
excel.DisplayAlerts = 0
Here's the error message:
Traceback (most recent call last):
File "TestMacro", line 6, in <module>
excel.Run('Apply_Process')
File "C:\Python27\lib\site-packages\win32com\client\dynamic.py", line282, in _ApplyTypes_
result = self._oleobj_.InvokeTypes(*(dispid, LCID, wFlags, retType, argTypes) + args)
pywintypes.com_error: (-2147352567, 'Exception occured.', (0, None, None, None, 0, -2146771191), None)