Connect Streamlit to a private Google Sheet
Introduction
This guide explains how to securely access a private Google Sheet from Streamlit Cloud. It uses the gsheetsdb library and Streamlit's secrets management.
If you are fine with enabling link sharing for your Google Sheet (i.e. everyone with the link can view it), the guide Connect Streamlit to a public Google Sheet shows a simpler method of doing this. If your Sheet contains sensitive information and you cannot enable link sharing, keep on reading.
Create a Google Sheet
If you already have a database that you want to use, feel free
to skip to the next step.
Enable the Sheets API
Programmatic access to Google Sheets is controlled through Google Cloud Platform. Create an account or sign in and head over to the APIs & Services dashboard (select or create a project if asked). As shown below, search for the Sheets API and enable it:
