import pandas as pd
import os
import win32com.client
import win32com.client.gencache
fname = "C:\\Users\\prashanth\\Desktop\\student.xls"
excel = win32com.client.gencache.EnsureDispatch('Excel.Application')
wb = excel.Workbooks.Open(fname)
wb.SaveAs(fname+"x", FileFormat = 51)
wb.Close()
excel.Application.Quit()
Traceback (most recent call last): File "c:\users\prashanth\appdata\local\programs\python\python36-32\lib\site-packages\win32com\client\gencache.py", line 536, in EnsureDispatch ti = disp.oleobj.GetTypeInfo() pywintypes.com_error: (-2147418111, 'Call was rejected by callee.', None, None)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "dailyreports2.py", line 6, in excel = win32com.client.gencache.EnsureDispatch('Excel.Application') File "c:\users\prashanth\appdata\local\programs\python\python36-32\lib\site-packages\win32com\client\gencache.py", line 547, in EnsureDispatch raise TypeError("This COM object can not automate the makepy process - please run makepy manually for this object") TypeError: This COM object can not automate the makepy process - please run makepy manually for this object