Here’s how you might approach creating an interactive table with file upload functionality:
First, ensure you have streamlit-aggrid installed in your environment.
pip install streamlit-aggrid
Since st.data_editor does not exist, you will need to adjust your approach.
import streamlit as st
import pandas as pd
from st_aggrid import AgGrid, GridOptionsBuilder
with st.form(key="file_form"):
upload_file = st.file_uploader("ファイルアップロード", type='html')
submit_btn = st.form_submit_button("OK")
cancel_btn = st.form_submit_button("キャンセル")
if submit_btn and upload_file is not None:
df = pd.read_html(upload_file, header=0, index_col=0)[0]
# Insert columns with default values as an example
df["DAR"] = None
df["Chain"] = None
df["calculate"] = False
# Create a grid options builder
gb = GridOptionsBuilder.from_dataframe(df)
gb.configure_default_column(editable=True, groupable=True)
# Customize the AgGrid display
gridOptions = gb.build()
# Display the dataframe with AgGrid
AgGrid(df, gridOptions=gridOptions, enable_enterprise_modules=True)
# Note: Direct editing with specific widgets like Selectbox or Checkbox inside the grid requires custom cell renderers.
Hope this helps!
Kind Regards,
Sahir Maharaj
Data Scientist | AI Engineer
If you’re using ChatGPT to generate forum answers, please double-check that your answers are correct before posting them – our docs are a great place to start.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.