docs icon indicating copy to clipboard operation
docs copied to clipboard

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

Open nccurry opened this issue 1 year ago • 3 comments

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 avatar Nov 13 '23 14:11 nccurry

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()

nccurry avatar Nov 13 '23 14:11 nccurry

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

sfc-gh-dmatthews avatar Jan 18 '24 03:01 sfc-gh-dmatthews

Thanks!

nccurry avatar Jan 18 '24 13:01 nccurry