使用 openpyxl 如何在不设置上限值和下限值的情况下逐行设置色标

Using openpyxl how can i set my colorscale row by row without setting upper and lower value

如问题所述,我想逐行应用色标条件格式。

我可以设置这个而不设置高值和低值吗,因为当报告是 运行 时我的数据总是不同的。 谢谢

我将 start_type、mid_type 和 end_type 用作 'num' 如果你使用百分位数,它就像一个魅力。 使用下面的控件,我可以设置一个范围,剩下的由代码完成

    color_scale_rule = ColorScaleRule(start_type="percentile",
                              start_value=0,
                              start_color=colors.RED,
                              mid_type="percentile",
                              mid_value=50,
                              mid_color=colors.YELLOW,
                              end_type="percentile",
                              end_value=100,
                              end_color=colors.GREEN)