Given this format:
format0 = workbook.add_format({'bg_color': 'none'})
I'd like to apply it (no background color) if the cell is blank. Here's what I've tried so far:
worksheet.conditional_format('B2:B14',
{'type':'cell',
'criteria': '=isblank()=True',
'format': format0
})
But I keep getting this error:
KeyError: 'value'
I'm pretty sure I'm not using a correct entry for 'criteria', but I'm not sure how to do it.
Thanks in advance!
One solution:
It appears that setting the color to 'none' produces blue cells, for some reason. So instead, I opted to color blank cells white:
format0 = workbook.add_format({'bg_color': 'white'})
Then, by reading the documentation (what a great idea!):
worksheet.conditional_format('B2:B14', {'type':'blanks', 'format': format0})
I put this before other conditional formats for the same column.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With