123456789101112131415 |
- import os
- import win32com.client
- excel = win32com.client.Dispatch('Excel.Application')
- excel.DisplayAlerts = False
- path = os.getcwd() + '\\Excel'
- # def convert(path):
- for file in filter(lambda x: x.endswith('.xls'), os.listdir(path)):
- print(file)
- fullname = path + '\\' + file
- excel.Workbooks.Open(fullname)
- excel.ActiveWorkbook.SaveAs(Filename=fullname + 'x', ConflictResolution=True)
- excel.ActiveWorkbook.Close(True)
|