streamlit / docs

Source code for the Streamlit Python library documentation
https://docs.streamlit.io
Apache License 2.0
113 stars 469 forks source link

Show example of configuring and consuming multiple data sources in .streamlit/secrets.toml #877

Open nccurry opened 11 months ago

nccurry commented 11 months ago

Link to doc page in question (if any): https://github.com/streamlit/docs/blob/main/content/kb/tutorials/databases/public-gsheet.md

Name of the Streamlit feature whose docs need improvement: Any Datasource, Google Sheets in my case.

What you think the docs should say: They should describe how to configure multiple data sources and consume them simultaneously.

nccurry commented 11 months ago

For example

# .streamlit/secrets.toml

[connections.name_one]
type = "gsheets"
spreadsheet = "https://docs.google.com/spreadsheets/d/xxxxxxx/edit#gid=0"

[connections.name_two]
type = "gsheets"
spreadsheet = "https://docs.google.com/spreadsheets/d/xxxxxxx/edit#gid=0"
# streamlit_app.py

import streamlit as st
from streamlit_gsheets import GSheetsConnection

# Create a connection object for the first spreadsheet
conn_one = st.connection("name_one", type=GSheetsConnection)
df_one = conn_one.read()

# Create a connection object for the second spreadsheet
conn_two = st.connection("name_two", type=GSheetsConnection)
df_two = conn_two.read()
sfc-gh-dmatthews commented 9 months ago

Thanks for the recommendation! We are continuing to update and add to our connections docs, so I'll keep this open for tracking. 😄

nccurry commented 9 months ago

Thanks!