标签:column exce lob AC print ons die dimen save
# automate_task for excel
from openpyxl.styles import colors
from openpyxl.styles import Font,Color
from openpyxl import styles
from openpyxl import load_workbook
from openpyxl import Workbook
wb_old = load_workbook(‘201805221400.xlsx‘)
wb_new = load_workbook(‘201805231400.xlsx‘)
wb_create = Workbook()
ws_old = wb_old.active
ws_new = wb_new.active
ws_create = wb_create.active
#for rowOfCellObjects in ws_old[‘B2‘:‘D2‘]:
# for cellObj in rowOfCellObjects:
# print(cellObj.coordinate, cellObj.value)
#print(‘--- END OF ROW ---‘)
ws_old.column_dimensions.group(‘A‘,‘D‘) = ws_new.column_dimensions.group(‘A‘,‘D‘)
b2 = ws_old[‘B2‘]
ft = Font(color=colors.RED,shadow = colors.RED)
b2.fill = styles.fills.GradientFill(stop=[‘FF0000‘, ‘FF0000‘])
wb_old.save(‘sameple.xlsx‘)
标签:column exce lob AC print ons die dimen save
原文地址:https://www.cnblogs.com/CodeUnknown/p/9075023.html