How to obtain a file generated within a deployed app (streamlit cloud)

Hi, I deployed an app in the streamlit cloud and it seems that everything is working fine. However, as the users interact with the app, a .csv file is generated (one file per user, the files are saved in the root folder when I execute the app locally). I need to download those .csv files (there are around 5 csv files that I need to download, one file per user).

However, I do not know how to obtain those csv files. Any ideas?

I know that a good option could be to save the file somewhere else, but in every step of the app the file is modified so it could be a lot of savings…

I can share the github repo if requested.
Any ideas or help would be much appreciated!

Options that I have considered:

  • Send the file via email: discarded
  • Save the data in a database: discarded
  • Save the data in a Google spreadsheet: tried but not sucessfully.
  • Add a download link: this is what I have done, but I don’t want the users to see this button, only me.

My solution for the moment have been to create a folder named “static” into the root folder, to access static files (without the need of the download button) with a direct link. However, I am worried because in the case of server restart or any kind of problem, this files would be lost (aren’t they?). So this make me wonder, how many time can a Streamlit Cloud app be alive? Can I make those files inside the “static” folder to be presistent?

Using a download button is a typical way.

1 Like

Yeah, as I wrote in my previous post, this is what I have done, however the files would disappear in the case of a server restart, isn’t it? Do you know if an app hosted in Streamlit Cloud have a limit timelife span? Or any kind of server limitations (restart every month, etc…)?

No, if you need your data to survive crashes and restarts you need to store it externally.

1 Like

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