Cannot save input at csv file Github

Hi I have an app where request people to provide input. The input is then auto save at a csv file at Github. It works when I run the apps at my local drive but when I deploy at streamlit using Github, the csv file is not updated. I create a test folder at below link. Appreciate if someone could assist me how to get the input save at the csv file.

app name → streamlit_app.py
csv file is save at → data/test.csv

Most likely it is “working”, in that it successfully saves the csv file, but it saves it on the Streamlit Cloud server that it’s running on, not on Github. If you wanted to then save the file to github, you would have to use git to add, commit and push the file to the repo after it is updated. You could probably accomplish that using GitPython Overview / Install — GitPython 3.1.27 documentation if you really wanted to.

Alternative methods to saving the file somewhere include:

  1. Writing the file to S3 with boto3: python - How to upload a file to directory in S3 bucket using boto - Stack Overflow
  2. Saving the csv to Google Sheets using gspread — gspread 5.4.0 documentation
  3. Allowing the user to download the csv after updating it How to download a Pandas DataFrame as a CSV? - Streamlit Docs

Hope that’s helpful!

HI blackary,
Thanks for your reply. It is informative. May I know how can I access my csv file at streamlit server? If there is no way to access, then probably I will try learn one of the method like google sheet. But if I can access the file at streamlit server, than I will be very happy to access this way. :smiley:

Hi @AliceKoh,

The easiest way to access the csv file on the server is just to add a file download button How to download a file in Streamlit? - Streamlit Docs

Hi blackary,
Oh ok. Thanks.