参考
https://blog.csdn.net/sinat_28576553/article/details/81275650
python 3.7 对 xlsx 文件修改
# -*- coding=utf-8 -*-
# 修改已经存在的 xlsximport openpyxl
# 1: 载入文件
workbook = openpyxl.load_workbook("./10modify_xlsx.xlsx")
worksheet = workbook.worksheets[0]
# 2: 第一列前插入数据
worksheet.insert_cols(1)
for index, row in enumerate(worksheet.rows):if index == 0:row[0].value = "编号" # row[0] 就是第一行else:row[0].value = index# 指定修改里面的数据
worksheet.cell(2, 3, "0")
worksheet["B2"] = "Peaking"# append 方法
Taiwan = [32, "台湾省"]
worksheet.append(Taiwan)# 枚举出来是tuple类型,从 0 开始计数
workbook.save(filename='./10modify_xlsx.xlsx')