How to WRITE data to a google sheet

Update: I found a solution, but this one is overwriting the existing data in the sheet.

        sheet_data = [
            {'Timestamp': current_timestamp, 'User_Input': user_input, 'User_Output': user_output]}
        ]
conn.update(worksheet="My_Sheet", data=sheet_data)

Is there a way to use append here?


Hello. Following this tutorial I can read data from a google sheet.
But what is the setting for WRITING data to a sheet?

Hi @roland71

Please see this related forum post for a code snippet to write data to a Google Sheet

Hope this helps!

2 Likes

Here’s an example app that shows how you can do this through the GSheet connector https://github.com/streamlit/gsheets-connection/blob/main/examples/pages/Service_Account_Example.py

3 Likes