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

As the question says I’d like to apply a colour scale conditional format row by row.

Can I set this up without setting the high and low values as my data is always different when the report is ran. Thanks

Add Comment
1 Answer(s)

I was using the start_type, mid_type and end_type as ‘num’ If you use percentile it works like a charm. Using the below controls, i can just set a range and the code does the rest

    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) 
Answered on July 16, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.