import openpyxl workbook = openpyxl.load_workbook('example.xlsx') worksheet = workbook.active # 写入数据到A1单元格 worksheet['A1'] = 'Hello, World!' # 保存文件 workbook.save('example.xlsx')