openpyxl模块介绍 ——原有excel表格中创建sheet ——并写入数据

 
 
import openpyxl

wb = openpyxl.load_workbook('C:\\Users\\del\\Desktop\\温职.xlsx')


ws1=wb.create_sheet('china',0)


#---------------------------------------------------------
ws1['A1'] = 'juankuan'
ws1['E1'] = '中国'
ws1['F1'] = '2020-02-27-09-51-02'

#-----------------------------------------------

wb.save('C:\\Users\\del\\Desktop\\温职.xlsx')




======================================================================================================






import
openpyxl wb = openpyxl.load_workbook('C:\\Users\\del\\Desktop\\温职.xlsx') sheetxx = wb.create_sheet('china',0) #--------------------------------------------------------- sheetxx['A1'] = 'juankuan' sheetxx['E1'] = '中国' sheetxx['F1'] = '2020-02-27-09-51-02' #----------------------------------------------- wb.save('C:\\Users\\del\\Desktop\\温职.xlsx')

猜你喜欢

转载自www.cnblogs.com/xiaobaibailongma/p/12387693.html