关于保留格式写(追加)excel 文件,
from xlutils.copy import copy
from openpyxl import load_workbook
wb=load_workbook(r"C:\Users\78434\Desktop\test.xlsx")
list=[0,1,2,3,4,5,6,7,8]
sheet=wb.get_sheet_by_name(‘Sheet1’)
rows=sheet.max_row
#sheet[‘A1’]=‘你是大帅哥 (或者美女)’ 写入单个单元格
for i in range(len(list)): #列表追加到 A 列中
sheet[‘A’+str(rows+1)]=list[i]
rows+=1
wb.save(r"C:\Users\78434\Desktop\test.xlsx")
👍🏻