excel 合并单元格内容数据写入

you can use this code to open (test.xlsx) file and modify A1 cell and then save it with a new name

import openpyxl
xfile = openpyxl.load_workbook('test.xlsx')

sheet = xfile.get_sheet_by_name('Sheet1')
sheet['A1'] = 'hello world'
xfile.save('text2.xlsx')


实例配置:

import openpyxl
xfile = openpyxl.load_workbook('./7月生产.xlsx')

sheet = xfile.get_sheet_by_name('汇总表')
sheet['F11'] = '888.88TB*天'


xfile.save('新的汇总表.xlsx')

  

posted @ 2023-08-07 11:02  Oops!#  阅读(54)  评论(0编辑  收藏  举报