st.data_editor: SelectboxColumn completely fails when pasting from Windows Excel due to hidden \r\n characters, blocking valid data entry

Summary of Issue:

When using st.data_editor with a column configured as an st.column_config.SelectboxColumn, users cannot paste valid values copied from Microsoft Excel on Windows. The Streamlit frontend strictly validates the pasted text against the Selectbox options list before any Python on_change callback can sanitize it.

Because Windows Excel silently appends carriage return and line feed characters (\r\n) to copied cells, Streamlit strictly evaluates "Valid Option\r\n" == "Valid Option" as False. The cell immediately turns red, rejects the paste, and blocks the user from proceeding.

This issue does not occur when pasting from macOS Excel, as the Apple clipboard does not use the strict \r\n terminator for single cells.

Expected Behavior:
Streamlit should automatically strip leading/trailing whitespace and control characters (like \r and \n) from the clipboard payload before evaluating it against the SelectboxColumn options. The value Admin should be successfully pasted into the Selectbox cell.

Actual Behavior:
The data editor rejects the paste. The cell outline turns red, and the value reverts. It is impossible to use on_change callbacks to intercept and strip() the data because Streamlit’s React frontend blocks the invalid data from ever reaching the Python backend.

Weirdly, Apple OS user can do the copy paste flawlessly

I think you should look at streamlit aggrid. once i started using it , i realize how powerful it is. The carriage return is Excel problem on windows and nothing to do with Streamlit.

Here is the aggrid option to handle the bug

“Set to true to work around a bug with Excel (Windows) that adds an extra empty line at the end of ranges copied to the clipboard.”

I suggest you look into aggrid as it is very powerful but has a learning curve. i use streamlit data editor for simple tasks only.