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()

标签: none

添加新评论