[Python] xls를 xlsx로 변환하는법, xlsx를 xls로 변환하는법
Lpla
·2020. 3. 25. 20:59
반응형
xls를 xlsx로 변환하는법
# xls to xlsx
import win32com.client as win32
fname = "11번가.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()
xlsx를 xls로 변환하는법
# xlsx to xls
from win32com.client import Dispatch
xl = Dispatch('Excel.Application')
wb = xl.Workbooks.Add('A.xlsx')
wb.SaveAs('A.xlsx'[:-1], FileFormat=56)
xl.Quit()
반응형