Reputation: 289
I am trying to apply conditional formatting to a union of ranges in excel, however, it does not seem to be working. This is the code I am trying to execute (ws is the excel writer's worksheet):
ws.conditional_format('K13:O27, K35:037', {'type': '3_color_scale',
'min_color': '#F8696B',
'mid_color': 'white',
'max_color': '#63BE7B',
'mid_value': '0',
'mid_type': 'num'})
but I am getting the following error message:
cell_1, cell_2 = args[0].split(':')
ValueError: too many values to unpack (expected 2)
Does anyone know if this is doable, and if yes - what is the format of the union operator I should use on my cell_range input variable?
Upvotes: 1
Views: 751
Reputation: 41644
Yes. That is possible using the conditional_format()
multi_range
parameter:
ws.conditional_format('K13:O27', {'type': '3_color_scale',
'min_color': '#F8696B',
'mid_color': 'white',
'max_color': '#63BE7B',
'mid_value': '0',
'mid_type': 'num',
'multi_range': 'K13:O27 K35:037'})
See the multi_range
section of the XlsxWriter docs on Working with Conditional Formatting.
Upvotes: 3