ValueError: Spreadsheet must be specified, but secrets file is correct and works locally

If you’re creating a debugging post, please include the following info:

  1. Are you running your app locally or is it deployed?

Locally it works, on the cloud it fails with the error shown below

  1. If your app is deployed:

    a. Is it deployed on Community Cloud or another hosting platform?

     On the Community Cloud
    

    b. Share the link to the public deployed app.

     https://testingappcapacityone.streamlit.app/
    
  2. Share the link to your app’s public GitHub repository (including a requirements file).

  1. Share the full text of the error message (not a screenshot).

ValueError: Spreadsheet must be specified

Traceback:

File "/home/vscode/.local/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 600, in _run_script
    exec(code, module.__dict__)File "/workspaces/Test-App-Streamlit/Streamlit_app.py", line 8, in <module>
    df = conn.read(index_col=False)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^File "/home/vscode/.local/lib/python3.11/site-packages/streamlit_gsheets/gsheets_connection.py", line 570, in read
    return self.client.read(
           ^^^^^^^^^^^^^^^^^File "/home/vscode/.local/lib/python3.11/site-packages/streamlit_gsheets/gsheets_connection.py", line 419, in read
    raise ValueError("Spreadsheet must be specified")

  1. Share the Streamlit and Python versions.

import streamlit as st

import pandas as pd

from streamlit_gsheets import GSheetsConnection

Create a connection object.

conn = st.connection(“gsheets”, type=GSheetsConnection)

df = conn.read(index_col=False)

st.write(st.secrets[‘connections’])

print(“Hello World”)

Looks like you forgot to specify a spreadsheet.

Thank you,

As I am new to coding, would it be possible to give me an example of how to specify the spreadsheet?

There are examples in the pypi page, including code and a link to a demo application.