使用python在已存在的excel数据表中的特定位置写入数据
excel表中的行和列都是从1开始的
代码:
# 使用python在已存在的excel数据表中的特定位置写入数据
# excel表中的行和列都是从1开始的
import openpyxl as op
filePath = r"F:/reptile\pinglun\Data\xinnongrenjihua02.xlsx"
tableAll = op.load_workbook(filePath)
table1 = tableAll['Sheet1']
table1.cell(2, 3, str(11))
tableAll.save(filePath)
结果: