Conditional Formatting xlwt

xlrd and xlwt still don't support conditional formatting. xlrd doesn't read it, xlwt doesn't write it.

There is a new and awesome module, called xlsxwriter. It does support conditional formatting out of the box. The project is active, documentation is pretty good. Plus, there are a lot of examples.

Here's 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()