首先安装 : pip install pywin32
import win32com.client as win32
fname = "C:\\标准化文档-20171226\\全量数据过滤表清单.xls"
excel = win32.gencache.EnsureDispatch('Excel.Application')
wb = excel.Workbooks.Open(fname)
wb.SaveAs(fname+"x", FileFormat = 51) #FileFormat = 51 is for .xlsx extension
wb.Close() #FileFormat = 56 is for .xls extension
excel.Application.Quit() #后缀名的大小写不通配,需按实际修改:xls,或XLS
原文链接:https://blog.csdn.net/yizhuanlu9607/article/details/89227908