I have encountered some issues with my private expense tracker app (maybe I will further improve the project and set it to public).
The app is connected to a private google sheet using streamlit_gsheets (GSheetsConnection). When I run the app locally, everything runs fine with the connection to google sheets and quering the data.
Originally the deployment on the streamlit cloud worked as well, but after about one week of usage I ran into this error message:
File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 535, in _run_script
exec(code, module.__dict__)File "/mount/src/schmeckels-tracker/Schmeckels.py", line 67, in <module>
data = conn.read(worksheet = "Datasheet", usecols= list(range(6)), ttl = 5)File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit_gsheets/gsheets_connection.py", line 570, in read
return self.client.read(File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit_gsheets/gsheets_connection.py", line 419, in read
raise ValueError("Spreadsheet must be specified")
data = conn.read(worksheet = “Datasheet”, usecols= list(range(6)), ttl = 5)
“”"
This should work according to all the tutorials out there and as mentioned above it already did run successfully on the cloud and runs perfectly locally.
Could it be that after a certain period of time, the Google API quote has been exceeded. Could you try putting the line data = conn.read() to be behind an if st.button() statement so that it does not consistently run every time the app is refreshed.
Here’s an excerpt from the above mentioned example:
# click button to update worksheet
# This is behind a button to avoid exceeding Google API Quota
if st.button("Create new worksheet"):
df = conn.create(
worksheet="Example 1",
data=df,
)
st.cache_data.clear()
st.experimental_rerun()
# Display our Spreadsheet as st.dataframe
st.dataframe(df.head(10))
thank you for the fast reply. Unfortunately, that didn’t solve my problem.
Since the app (including sheet connection) works perfekly fine when I host it locally I assume the problem is somehow connected to the cloud deployment.
As before the app still starts when deployed to the cloud but the same error message keeps coming up.
What I do not understand is the spreadsheet is defined according to the documentation using "worksheet = " which already worked on the cloud and still does locally.
I am thankful for any possible solutions you might have.
Can you make sure you have pinned a specific version of your dependencies locally and on cloud, using requirements.txt? What you’re describing sounds like you might have a dependency that got auto-updated on cloud, and didn’t get updated on local, so you’re running two different versions of some dependency.
Note that spreadsheet and worksheet are different – spreadsheet specifies a Google Sheet, and worksheet specifies which tab of that sheet should be used. Can you also make sure that your secrets.toml locally and your secrets on cloud are the same?
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.