Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Streamlit GSheetsConnection
Connect to public or private Google Sheets from your Streamlit app. Powered by
st.experimental_connection()
and gspread.GSheets Connection works in two modes:
Follow Initial setup for CRUD mode section in order to authenticate your Streamlit app first.
Initial setup for CRUD mode
.streamlit/secrets.toml
inside your Streamlit app root directory,check out Secret management documentation for references.
You will automatically download a JSON file with credentials. It may look like this:
Remember the path to the downloaded credentials file. Also, in the next step you’ll need the value of client_email from this file.
gspread.exceptions.SpreadsheetNotFound
exception when trying to access this spreadsheet from your application or a script.streamlit/secrets.toml
placeservice_account
configuration from downloaded JSON file, in the following format (wheregsheets
is yourst.connection
name):Publicly Shared Spreadsheet Example
Service Account Example
# requirements.txt streamlit==1.22 git+https://github.com/sfc-gh-jcarroll/st-connection-prpr.git#subdirectory=gsheets_connection pandasql # this is for example/st_app.py only
Note on install: Streamlit 1.22 is not yet released; you can find a compatible .whl file
here.
Full example
Check gsheets_connection/example directory for full example of the usage.
Q&A
GSheets Connection works in two modes:
Follow Initial setup for CRUD mode section in order to authenticate your Streamlit app first.