I wrote some code to do the conditional formatting. However, whenever I run the code, the cell are written with same conditional formatting once. Is there any way to clear the existing ones and write the new.
I have checked the offical documentation https://openpyxl.readthedocs.io/en/stable/formatting.html but no clear function inside
If you just want to clear the formatting for a particular worksheet you just need to create a new list:
from openpyxl.formatting.formatting import ConditionalFormattingList
ws.conditional_formatting = ConditionalFormattingList()
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