How to write a file on a repo from a deployed streamlit application?

Hello, I recently deployed an application through streamlit-share and it was seamless and awesome. I was wondering if it is possible to write to a file in the repository from which the application was also deployed. My use-case sort of resembles a signup page where people can enter their name and email for later usage which will be written into a file through the application. with lack of knowledge, I presumed it will work but it doesn’t. I’m new to learning things, so if there’s any other way to approach this problem I’d be very thankful to know.

Hi @R0han -

Glad to hear you found Streamlit sharing to be so easy to use!

In terms of saving things, this doesn’t really work, because Streamlit sharing is a container environment. Meaning, each app runs in its own container, and it’s possible that multiple copies of that container could be running (depending on the resources its allocated). So any saving of information locally would only be available within that container, it wouldn’t represent a global file that everyone is writing to.

If you want to do something like you are describing, you would need to write to a database backend, a Google Sheet, or some other persistent storage medium. This will be made much easier and more secure once secrets management is released (which unfortunately, I don’t have the timeline for).


Hello @randyzwitch, thank you for your valuable advice, a lot of learning right here. I’ll now look into Google-Sheet API and integration.