This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
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()