Colorset

colorset.py
import openpyxl
from openpyxl.styles import PatternFill, colors
from demo.src.demo.Data_Process import readCashFlowlAdjuestmentFilexlsx

ffnpath = r’C:\wz\pythonFile\crashflow_sg_template_Weekly.xlsx’

ffnpath = r’C:\Users\Public\pythonFile1\crashflow_sg_template_Weekly.xlsx’
wb = openpyxl.load_workbook(ffnpath,data_only=True)
fill_3 = PatternFill(“solid”, fgColor=colors.RED)
names = wb.sheetnames
sheet = wb[names[0]]
sht = wb.worksheets[0]
str1 = []
for one_column_data in sheet.iter_rows():
print(one_column_data[7].value)
if one_column_data[7].value == None:
str1.append(1)
else:
str1.append(‘no fill’)
print(str1)
for x in range(len(str1)):
if str1[x] == 1:
strx = str(x+1)
Ax = “A” + strx
Bx = “B” + strx
Cx = “C” + strx
Dx = “D” + strx
Ex = “E” + strx
Fx = “F” + strx
Gx = “G” + strx
Hx = “H” + strx
Ix = “I” + strx
jx = “j” + strx
Kx = “K” + strx
Lx = “L” + strx
Mx = “M” + strx
Nx = “N” + strx
Ox = “O” + strx
Px = “P” + strx
Qx = “Q” + strx
Rx = “R” + strx
print(Ax)
sht[Ax].fill = fill_3
sht[Bx].fill = fill_3
sht[Cx].fill = fill_3
sht[Dx].fill = fill_3
sht[Ex].fill = fill_3
sht[Fx].fill = fill_3
sht[Gx].fill = fill_3
sht[Hx].fill = fill_3
sht[Ix].fill = fill_3
sht[jx].fill = fill_3
sht[Kx].fill = fill_3
sht[Lx].fill = fill_3
sht[Mx].fill = fill_3
sht[Nx].fill = fill_3
sht[Ox].fill = fill_3
sht[Px].fill = fill_3
sht[Qx].fill = fill_3
sht[Rx].fill = fill_3
print(‘fill done!’)

wb.save(ffnpath)
import os
os.startfile(ffnpath)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值