With the current version of streamlit v. 1.32.0, it is possible to download csv files directly:
How can I set the filename of the CSV file that gets downloaded? Per default, it creates <timestamp>_export.csv
, however I did not find any option to set the download name in the API reference.
Thank you very much for your help!
Hi @johanneswerner,
Thanks for sharing this question!
The download feature is not customizable. You however get the opportunity to the name the file when you hit the download button. If you want a customized download name, you might consider using st.download_button
.
@tonykip Thank you for your swift and dedicated reply. I already have an implementation with st.download_button
, however I would like to implement the possiblity to use the same download name in both cases.
Is it possible to overload st.download_button
? Or would it rather make sense to open a feature request in the streamlit github repo?
Thank you very much for your help.
What do you mean by βoverload st.download_button
β?
So you would like to use the same name you use with st.download_button
with the downloader within the st.dataframe
?
For reference, youβre using the st.download_button
with custom file name like this right?
st.download_button(
label="Download data as CSV",
data=csv,
file_name="custom_filename.csv",
mime="text/csv"
)
Yes, correct, this is the way I am using st.download_button()
. And I would like to use a naming schema for the download field in the top of the dataframe that (a) has the similar filename and (b) has a better understandable filename than <timestamp>_export.csv
. Is it possible to redefine the st.dataframe()
function? (of course, overload was the wrong term)