赞
踩
- def convert_to_xlsx(file_path):
- excel_app = win32.Dispatch("Excel.Application")
- file_xlsx = file_path.replace(".xls", ".xlsx")
-
- excel_app.Visible = False
- excel_app.DisplayAlerts = False
-
- workbook = excel_app.Workbooks.Open(os.path.abspath(file_path))
- # 51 refers to the .xlsx format in VBA
- workbook.SaveAs(os.path.abspath(file_xlsx), FileFormat=51)
- workbook.Close()
- excel_app.Quit()
-
- return file_xlsx
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。