Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
python xlsxwriter条件格式不更新_Python_Excel_Conditional Formatting_Xlsxwriter - Fatal编程技术网

python xlsxwriter条件格式不更新

python xlsxwriter条件格式不更新,python,excel,conditional-formatting,xlsxwriter,Python,Excel,Conditional Formatting,Xlsxwriter,我试图对excel文件应用条件格式,但遇到了一些奇怪的行为 代码如下所示: # fill table with data format1 = workbook.add_format() format1.set_bg_color('red') conditionalFormatOptions = {'type' : 'formula', 'criteria' : '=ODER($C2="<unknown>",$C2="unknow

我试图对excel文件应用条件格式,但遇到了一些奇怪的行为

代码如下所示:

# 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()
#用数据填充表格
format1=工作簿。添加\u格式()
格式1.设置背景颜色(“红色”)
条件格式={'type':'formula',
“标准”:“=订单($C2=”,$C2=”未知“)”,
“格式”:format1}
工作表.条件格式(1,0,len(选定文件),len(表格内容)-1,条件格式)
工作簿.关闭()

奇怪的是,它有点有效:-)如果我在excel中打开条件格式选项,双击它来编辑规则,然后在不更改任何内容的情况下单击“确定”,规则就会正确应用。看起来好像缺少刷新或类似的内容。有什么办法解决这个问题吗?我正在使用python 2.7.12 excel 2013和最新版本的xlsxwrite(0.9.4)

正如jmcnamara所述,所有公式都需要使用美式英语表示法。将“order”改为“OR”可以解决问题。非常感谢

我使用的是德文版的excel,因此是“order”,或者……你需要使用美文版的公式。请参阅XlsxWriter文档:谢谢。愚蠢的我。我已将分号改为逗号,但忽略了明显的函数名。。。甚至在评论中也提到了