You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
506 B

3 days ago
from openpyxl import load_workbook
excel_file = r'D:\dsWork\dsProject\dsLightRag\Doc\T1、史校长资料\测试结果\100题测试结果.xlsx'
# 1、利用EXCEL工具读取O1的内容
wb = load_workbook(excel_file)
ws = wb.active # 获取第一个sheet
O1_content = ws['O1'].value # 获取O1单元格内容
print(f"O1单元格内容为: {O1_content}")
# 2、写入示例
ws['O1'] = "【理想】召回文本" # 修改O1单元格内容
wb.save(excel_file) # 保存修改
wb.close()