python xlsxwriter conditional format does not update

519 views Asked by At

I'm trying to apply a conditional format to an excel file and faced some strange behavior.

The code looks as follows:

# fill table with data
format1 = workbook.add_format()
format1.set_bg_color('red')
conditionalFormatOptions = {'type' : 'formula',
                            'criteria' : '=ODER($C2="<unknown>",$C2="unknown")',
                            'format' : format1 }
worksheet.conditional_format(1, 0, len(selectedFiles), len(tableContent)-1, conditionalFormatOptions)
workbook.close()

The strange thing is, it kind of works :-) If I open the conditional formatting options in excel, edit the rule by double-clicking it and hit ok without changing anything, the rule applies correctly. It looks like there is a refresh or something similar missing. Any ideas how to solve this? I am working with python 2.7.12 excel 2013 and the latest version of xlsxwrite (0.9.4)

1

There are 1 answers

0
littleHue On BEST ANSWER

As stated by jmcnamara, all formulas need to be in US-English notation. Changing "ODER" to "OR" solves the problem. Thanks a lot!