如何使用python填充Excel中的背景单元格?

时间:2019-07-24 18:45:16

标签: python excel openpyxl

我有一个excel文件,无法填充单元格的背景色。下面是代码

 import openpyxl
 import pdb
 from openpyxl import Workbook
 from openpyxl.styles import Color, PatternFill, Font, Border
 from openpyxl.styles import colors
 from openpyxl.cell import Cell
 wb = openpyxl.load_workbook('fancy.xlsx')
 ws = wb.active
 fill = PatternFill(fill_type=None,start_color='FFFFFFFF',end_color='FF000000')
 ws['A2'].fill = fill

0 个答案:

没有答案