This repository contains all the necessary files to deploy a Streamlit application. This project securely handles Google credentials using Streamlit's secrets management system to interact with Google Sheets and Google Drive.
This Streamlit application allows users to submit responses that are stored in a Google Sheet. The app is deployed on Streamlit Cloud, and Google credentials are securely managed using the Streamlit secrets management system.
main.py: The main Streamlit application file..streamlit/secrets.toml: Contains the Google credentials in TOML format.
Ensure you have the following installed:
- Python 3.7 or higher
- Streamlit
- Google API Client Libraries (
google-auth,google-auth-oauthlib,google-auth-httplib2,gspread,pydrive)
You can install the necessary Python packages using the requirements.txt file:
pip install -r requirements.txtClone the repository to your local machine using the following command:
git clone https://github.com/mmm-byte/Streamlits_Projects/tree/3c13a1bbdee8000a18e7af1e64cd65a9fd2f90b5/Feedback_Chatbot
cd your-repositoryTo securely handle your Google credentials, use the Streamlit secrets management system. Convert your credentials.json to a TOML format and add it to the Streamlit secrets file.
Example secrets.toml:
[GOOGLE_CREDENTIALS]
type = "service_account"
project_id = "your-project-id"- Go to Your Streamlit Cloud Workspace: Open Streamlit Cloud.
- Select Your Application: Navigate to the app you want to deploy.
- Go to the Settings of Your Application:
- Click on the app you want to configure.
- Click on the "Settings" icon (⚙️).
- Add Secrets:
- In the "Secrets" section, add your secrets as key-value pairs.
- Add a secret with the key
GOOGLE_CREDENTIALSand paste the TOML content of your credentials as the value.
- Save and Deploy: Save your changes and deploy your app.
If you want to run the app locally for testing purposes, follow these steps:
- Set the environment variables for Google credentials:
export GOOGLE_CREDENTIALS='{
"type": "service_account",
"project_id": "your-project-id",
}'- Run the Streamlit app:
streamlit run main.pyThis README file provides a clear and concise setup process for your Streamlit application.