1、先导入openpyxl库,如没有先用pip安装(pip install openpyxl
)
import openpyxl
2.打开表格进行操作
excel_file = "文件名.xlsx"
open_work_book = openpyxl.load_workbook(excel_file)
sheet = open_work_book.active
3、对表格操作后进行保存
sheet.cell(row=row[0].row, column=4, value=json.dumps(rule, ensure_ascii=False))
open_work_book.save(excel_file)
标签:openpyxl,表格,python,读写,excel,book,file,open From: https://www.cnblogs.com/xiaoshuii/p/17754711.html