Perform insert operation using st-gsheets-connection in private sheet

:rotating_light: Before clicking “Create Topic”, please make sure your post includes the following information (otherwise, the post will be locked). :rotating_light:

  1. Are you running your app locally or is it deployed? → Locally
  2. If your app is deployed:
    a. Is it deployed on Community Cloud or another hosting platform? → No
    b. Share the link to the public deployed app. → NA
  3. Share the link to your app’s public GitHub repository.
  4. Share the full text of the error message (not a screenshot). → NA
  5. Share the Streamlit and Python versions.3.11

I want to know if I can perform insert operation to the Google Sheet using st.connection? I can see examples of CRUD - but I have a very simple requirement where I just want to perform insert without pulling the data in df. So everytime I click submit button - a new row is created with the submitted data is added to existing records in google sheet.

instead of conn.update(worksheet=“Sheet1”, data=df)
conn.insert(worksheet=“Sheet1”, data=df)


Insert operation does not exist. Have a look at gsheets-connection/streamlit_gsheets/ at main · streamlit/gsheets-connection · GitHub

But your intention can be accomplished with update.

Yes, I can use updates - but the issue with update is that I will have to download dataset and insert a new row to df and pass it back which is resource consuming.

Thanks for the reply.

The overhead should not be that much as inserting (if implemented) still involves at least opening the data file and do the writing. To update, the data is read (opening a file) and then add your new data.