【发布时间】:2023-04-15 08:10:02
【问题描述】:
我正在使用 Gspread 格式为 Google 表格中的单元格设置背景颜色。 现在我想使用 GradientRule 来完成这个:
Conditional formatting with GradientRule
我知道我必须设置一个“最小点”和一个“最大点”,但我不知道该怎么做。
这是我目前得到的:
def color():
spr = client.open("Kleurtjes")
sheet = spr.worksheet("Tab3")
rule = ConditionalFormatRule(
ranges=[GridRange.from_a1_range('A1:A10', sheet)],
GradientRule=GradientRule(
minpoint(format=CellFormat(backgroundColor=Color(255,255,255)), type='number'),
maxpoint(format=CellFormat(backgroundColor=Color(0,128,0)), type='number')
)
)
rules = get_conditional_format_rules(sheet)
rules.append(rule)
rules.save()
你能帮帮我吗?
非常感谢!
【问题讨论】:
标签: python google-sheets-api gspread