Connecting your app that is deployed on Streamlit cloud to a private google sheet

For anyone that is struggling to find a solution, as I did.
Most,if not all, of the online tutorials on how to connect your app with a private google sheet suggest to create a new ./.streamlit/secrets.toml file and store the connection credentials in the file. Although that works if you run your app on localhost, when you deploy your app through a github repo on streamlit cloud you ll be facing an error "
Public Spreadsheet cannot be written to, use Service Account authentication to enable CRUD methods on your Spreadsheets."
After a lot of pain, i figured out that on streamlit cloud you need to store the connection credentials on your actual streamllit app at “My apps on top left-> settings of the app → secrets”. I wanted to share that as the online instructions don’t make that clear.
To complete the process just follow the instructions at Connect Streamlit to a private Google Sheet - Streamlit Docs but don’t create the secrets.toml file on github.Just store the credentials on your account.

It is explained at the end of the tutorial.

2 Likes

You are absolutely right.Didn’t even notice.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.