Validation rules are just not working from Openpyxl 3.1.0
I have generated xls with Openpyxl with lots of cell validations. When I upgraded to 3.1.2 they started to not working. Lists are working, but no warning is given, if any invalid value is given. If I change manually the validation in Excel, it is OK. I tried different versions and it seems, that 3.0.10 was OK, now 3.1.0 is not OK any more.
Simple code what can be used to detect the problem: version = openpyxl.version print(version)
#Create the workbook and rename its worksheet wb = Workbook() ws = wb.active
dv = DataValidation(type="list", formula1='"Dog,Cat,Bat"', allow_blank=True) dv.error ='Your entry is not in the list' dv.errorTitle = 'Invalid Entry' dv.prompt = 'Please select from the list' dv.promptTitle = 'List Selection' ws.add_data_validation(dv)
c1 = ws["A2"] c1.value = "Dog" dv.add(c1)
ws["A3"] = 'Openpyxl version' ws["A4"] = version
#save it wb.save("trial.xlsx")
print('We are ready')
=> in 3.1.0 if you go over cell B2, nothing is shown. In 3.0.10 it is working as expected. Also in case of 3.1.0 you can enter anything into B2.