broken worksheet when validation is not applied to any cell
Created originally on Bitbucket by b_quast (Björn Quast)
As of 2.4 openpyxl produces a broken worksheet when a data validation is added but not used by any cell:
#!python
float_validation = DataValidation(type='decimal')
worksheet.add_data_validation(float_validation)
# when the validation is not used later on
# not executed: float_validation.add(cell)
When opening the resulting excel table, Excel complains about unreadable content in that worksheet. This applies to Excel 2010. Sorry, I have only a german language version of Excel, thus the attached image of the warning message is in german. One can choose to trust the excel worksheet.