Create a service account & key file
To use the Sheets API from Streamlit Cloud, you need a Google Cloud Platform service account (a special account type for programmatic data access). Go to the Service Accounts page and create an account with the Viewer permission (this will let the account access data but not change it):
The button CREATE SERVICE ACCOUNT is gray, you don't have the correct permissions. Ask the admin of your Google Cloud project for help.
After clicking DONE, you should be back on the service accounts overview. First, note down the email address of the account you just created (important for next step!). Then, create a JSON key file for the new account and download it:
Share the Google Sheet with the service account
By default, the service account you just created cannot access your Google Sheet. To give it access, click on the Share button in the Google Sheet, add the email of the service account (noted down in step 2), and choose the correct permission (if you just want to read the data, Viewer is enough):
