用python淘汰excel篇:批量把xls格式转为xlsx格式
import os
import win32com.client as win32
from openpyxl import load_workbook, Workbook
def f_xlsx(path):
excel = win32.gencache.EnsureDispatch('Excel.Application')
fld = os.listdir(path)
for i in fld:
if i[-4:] == ".xls":
i = path + i
j = i + "x"
wb = excel.Workbooks.Open(i)
wb.SaveAs(j, FileFormat=51)
os.remove(i)
wb.Close()
excel.Application.Quit()