import openpyxl,os
from openpyxl.styles import Alignment
from openpyxl import load_workbook
os.chdir(r'C:\Users\Administrator\AppData\Local\Programs\Python\Python39')
wb=openpyxl.Workbook()
sheet=wb.active
sheet.title='考勤'# 给sheet页命名
wb.create_sheet(index=3,title='FGH')
wb.create_sheet(index=5,title='FGH')
sheet=wb['考勤']
cell=sheet['A1']
sheet['A2']='部门'
sheet['B2']='姓名'
sheet['C2']='收货地址'
sheet['D2']='数量'
sheet['E2']='物品编号'
alignment = Alignment(horizontal='center',vertical='center',wrap_text=True)
cell.alignment = alignment
sheet['A1']='员工内购信息登记表'
# 合并
sheet.merge_cells('A1:E1')
#sheet.merge_cells(start_row=1, start_column=3,
#end_row=2, end_column=4)# 取消合并
#sheet.unmerge_cells('A1:B2')
# end_row=2, end_column=4)
#print(sheet['A2'].value)
#print(wb.sheetnames)
wb.save('LOVE100.xlsx')