Python 的xlutils模块

python模块:

    xlrd:读取excel

    xlwt:写入excel 缺点:excel格式无法复用 

推荐xlutils模块

    可复制原excel格式

 from xlutils.copy import copy

 2. 获取复制excel的sheet页

rb = xlrd.open_workbook(goal_file,formatting_info=True)   # 参数说明: formatting_info=True 保留原excel格式

rs = rb.sheet_by_index(0) 

wb = copy(rb)

ws = wb.get_sheet(0)
ws.write(1, 6, 'changed!') 
wb.save(goal_file)

#xlrd模块0.8版本后不支持以xlsx为后缀名文件
以前-好记性不如烂笔头 现在-好记性不如烂键盘
原文地址:https://www.cnblogs.com/gexbooks/p/9681057.html