PablocFonseca / streamlit-aggrid

Implementation of Ag-Grid component for Streamlit
https://pypi.org/project/streamlit-aggrid/
MIT License
1.05k stars 199 forks source link

KeyError: 'ExcelBlob' #233

Open sfc-gh-pkommini opened 1 year ago

sfc-gh-pkommini commented 1 year ago

This is the code

def draw_table() -> None:
    df = st.session_state.df
    df_filtered = prepare_data_for_table(df)

    options = GridOptionsBuilder.from_dataframe(
        df_filtered,
        enableRowGroup=True,
        enableValue=True,
        enablePivot=True,
    )
    options.configure_pagination(
        paginationAutoPageSize=False,
        paginationPageSize=50,
    )
    options.configure_grid_options(sideBar={"toolPanels": ['filters']})

    if not len(st.session_state.pre_selected_rows):
        options.configure_selection(
            selection_mode='multiple',
            use_checkbox=True,
            header_checkbox=True,
        )
    else:
        options.configure_selection(
            selection_mode='multiple',
            use_checkbox=True,
            header_checkbox=True,
            pre_selected_rows=st.session_state.pre_selected_rows,
        )

    grid_return = AgGrid(
        df_filtered,
        columns_auto_size_mode=ColumnsAutoSizeMode.FIT_ALL_COLUMNS_TO_VIEW,
        data_return_mode=DataReturnMode.FILTERED,
        gridOptions=options.build(),
        theme=AgGridTheme.ALPINE,
        key='review_data',
    )
    st.session_state.pre_selected_rows = grid_return['selected_rows']

Got the following error

  File "/opt/homebrew/Caskroom/miniconda/base/envs/snowpark/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script
    exec(code, module.__dict__)
  File "/Users/<redacted>/sfc-workspace/streamlit-uar/uar/<my_app>.py", line 23, in <module>
    draw_table()
  File "/Users/<redacted>/sfc-workspace/streamlit-uar/uar/utils/ui.py", line 61, in draw_table
    grid_return = AgGrid(
  File "/opt/homebrew/Caskroom/miniconda/base/envs/snowpark/lib/python3.10/site-packages/st_aggrid/__init__.py", line 436, in AgGrid
    response.excel_blob = component_value['ExcelBlob']
KeyError: 'ExcelBlob'