Need all checkbox title from st.expander

Welcome to the community and thanks for your detailed question! :blush: To get all the checkbox titles from the second st.expander (“Excluded”), you just need to collect the column names that are not in st.session_state.columns. Here’s how you can do it:

Add this line after your for loop (where you create the checkboxes):

excluded_titles = [col for col in df.columns if col not in st.session_state.columns]
st.write("Checkbox titles in 'Excluded':", excluded_titles)

This will display a list of all checkbox titles currently in the “Excluded” expander. For more context and similar UI logic, see the discussion at Streamlit forum: column selection in the dashboard.

Sources: