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')
标签:xlsx,sheet,openpyxl,excel,单元格,写入,xfile,save,name From: https://www.cnblogs.com/weifeng1463/p/17610899.html