import xlrd
import xlwt
from xlutils.copy import copy
# 读取工作簿
objWB = xlrd.open_workbook(r'C:\Users\IBM\Desktop\新建文件夹\S1-2\日统计.xls', formatting_info=True)
# 对象变量赋值
objSht = objWB.sheet_by_name('Sheet2')
# 复制工作簿
newWB = copy(objWB)
#获取第一个工作表
newSht = newWB.get_sheet(0)
#定义style y样式
Style = xlwt.XFStyle()
#定义Font 字体
Font = xlwt.Font()
Font.name = '微软雅黑'
Font.bold = True
Font.height = 18 * 20
Style.font = Font
#定义Borders 边框
Borders = xlwt.Borders()
Borders.top = xlwt.Borders.THIN
Borders.bottom = xlwt.Borders.THIN
Borders.left = xlwt.Borders.THIN
Borders.right = xlwt.Borders.THIN
Style.borders = Borders
#定义Alignment 对齐方式
Alignment = xlwt.Alignment()
Alignment.horz = xlwt.Alignment.HORZ_CENTER
Alignment.Vert = xlwt.Alignment.VERT_CENTER
Style.alignment = Alignment
#输入数据和相应Style
newSht.write(2, 1, 12, Style)
newSht.write(3, 1, 12, Style)
newSht.write(4, 1, 12, Style)
newSht.write(5, 1, 12, Style)
#保存
newWB.save(r'C:\Users\IBM\Desktop\新建文件夹\S1-2\日统计1.xls')