I basically copied the example on DataValidation using openpyxl from the docs (https://openpyxl.readthedocs.io/en/stable/validation.html).
The only difference is that I set the showDropDown arg to True. Unfortunately, this doesn't make any difference, i.e. when I open the Excel sheet, I don't see the dropdown menu. In fact, it has not been enabled at all (compare screenshot).
from openpyxl import Workbook
from openpyxl.worksheet.datavalidation import DataValidation
# Create the workbook and worksheet we'll be working with
wb = Workbook()
ws = wb.active
# Create a data-validation object with list validation
dv = DataValidation(
type="list", formula1='"Dog,Cat,Bat"', allow_blank=True, showDropDown=True
)
# Optionally set a custom error message
dv.error = "Your entry is not in the list"
dv.errorTitle = "Invalid Entry"
# Optionally set a custom prompt message
dv.prompt = "Please select from the list"
dv.promptTitle = "List Selection"
# Add the data-validation object to the worksheet
ws.add_data_validation(dv)
dv.add(ws["A1"])
wb.save(filename="dropdown_issue.xlsx")
