Home > other >  Python update XLSX file to retain the original format
Python update XLSX file to retain the original format

Time:05-28


Initially use formatting_info=True, test down, only useful to the XLS file format,

Workbook=XLRD. Open_workbook (' a.x ls' formatting_info=True)
Wt=copy (workbook)

Wt. Save (' b.x ls')

Later openpyxl is successful, the HTML code is as follows, not the module is installed by oneself,

Wb=openpyxl. Load_workbook (' a.x LSX ')
Sheetnames=wb. Sheetnames
Sheet=wb [sheetnames [0]]
Insert content sheet [' G1]=' '
Sheet [' G2]='insert content 22'
Sheet [' D4 ']='modify the content'
Wb. Save (' b.x LSX ')
  • Related