xlrd and xlwt still do not support conditional formatting. xlrd does not read, xlwt does not write.
There is a new amazing module called xlsxwriter . It supports conditional formatting out of the box. The project is active, the documentation is pretty good. In addition, there are many examples .
Here is an example:
from xlsxwriter.workbook import Workbook workbook = Workbook('test.xlsx') worksheet = workbook.add_worksheet() worksheet.write('A1', 49) worksheet.write('A2', 51) format1 = workbook.add_format({'bold': 1, 'italic': 1}) worksheet.conditional_format('A1:A2', {'type': 'cell', 'criteria': '>=', 'value': 50, 'format': format1}) workbook.close()
source share