---
title: "Discussion on \"openpyxl Drop-Downs Accept Anything by Default: showErrorMessage Is False\" | Hashnode"
description: "Discussion on \"openpyxl Drop-Downs Accept Anything by Default: showErrorMessage Is False\". openpyxl defaults to showErrorMessage=False, so a generated Excel drop-down accepts any value. The one-line fix, and a check for files."
url: "https://hashnode.com/posts/openpyxl-drop-downs-accept-anything-by-default-showerrormessage-is-false/6ad007e993cd1dc6a67521ca"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [openpyxl Drop-Downs Accept Anything by Default: showErrorMessage Is False](https://aitoolsprimer.hashnode.dev/openpyxl-drop-downs-accept-anything-by-default-showerrormessage-is-false?utm_source=hashnode&utm_medium=feed)

openpyxl defaults to showErrorMessage=False, so a generated Excel drop-down accepts any value. The one-line fix, and a check for files.

Oct 14 · 4 min read · aitoolsprimer.hashnode.dev  
Read the article

-   [#python](https://hashnode.com/tag/python)
-   [#excel](https://hashnode.com/tag/excel)
-   [#openpyxl](https://hashnode.com/tag/openpyxl)

## Written by

[AI Tools Primer](https://hashnode.com/@aitoolsprimer)

@aitoolsprimer · Palermo, Italy

  
[View profile](https://hashnode.com/@aitoolsprimer)

Independent guides to AI tools and everyday software. Every price and limit is checked before it is published.

I run AI Tools Primer (https://aitoolsprimer.com), independent plain-English guides to AI tools and everyday software. The rules the site runs on: verify, never remember (every price, limit and feature is checked before it is published, and the page says when); if something cannot be verified, the guide says so; and nobody pays to be here, with no affiliate links and no paid placements. I also build the site itself: the navigation is a three.js island city with two squares and twenty-five towers, https://aitoolsprimer.com/3d-island.html

## Responses 2

Markdown supported · ⌘↵ to post

[Yunus Emre Vurgun](https://hashnode.com/@yunusemrevurgun)

[Oct 17](https://hashnode.com/posts/openpyxl-drop-downs-accept-anything-by-default-showerrormessage-is-false/6ad007e993cd1dc6a67521ca/comment/6ad30797771163c8644b6515)

This one bites a lot of people because the drop-down arrow appears, so the file looks validated when it isn't. Setting showErrorMessage=True (and errorStyle='stop') fixes typing, but it's worth knowing that pasting a value into the cell still bypasses data validation in Excel entirely, so anything downstream should re-check values when reading the file back. Another gotcha: an inline list in formula1 is capped at 255 characters, so longer option lists should point to a range on a (possibly hidden) sheet instead. A quick round-trip test that loads the saved file and asserts dv.showErrorMessage is True makes a nice regression check.

[AI Tools Primer](https://hashnode.com/@aitoolsprimer)

[Oct 29](https://hashnode.com/posts/openpyxl-drop-downs-accept-anything-by-default-showerrormessage-is-false/6ad007e993cd1dc6a67521ca/comment/6ad30797771163c8644b6515#reply-6ae2ee35bfd67deb92fa5c4f)

Thank you, Yunus, this is a very useful addition. On the paste point: LibreOffice Calc's own help says the validity rule does not take effect for values inserted by copy and paste or by drag and drop, and the same page points to Tools - Detective - Mark Invalid Data to show cells that already hold invalid values. So re-checking the values when the file is read back, as you suggest, is a sound habit, and a round-trip test on showErrorMessage is a neat way to catch the default.
