Toml file can't connect with python file

I’m using vscode for my project and I have 4 files in it.
image

Info about my spreadsheet is in the secrets.toml
image

My app is in connection.py

When I run my app I get a ValueError: ‘Spreadhseet must be specified’ even though it is specified in secrets.toml

How do I solve this? I have restarted my app many times I still get the error. Is there a way to connect the secrets.toml to my connection.py? Cause I think the py file doesn’t recognize it

It looks like connection.py might be stored inside of the .streamlit folder – can you try moving that Python file outside of the .streamlit folder?

Actually none of them are. The folder is empty. secrets.toml was in that folder but I moved it outside

secrets.toml should be stored inside the .streamlit folder

It was there the first time, din’t work then I moved it outside

It also looks like your private_key (in your secrets file) includes “------BEGIN PRIVATE KEY----” – can you try taking that part out so it’s just the private key?

Still gives an error

Can you share a screenshot of the current file structure?

One sanity check is to do st.write(st.secrets['connections']) – that should show you whether or not it is in fact loading the secrets.toml file.

1 Like

Now it’s working thankyou

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.