I currently struggling with the use of the streamlit.download_button .
- I’m uploading a xlsx file to the streamlit app via file_uploader
- Read the excel file with pd.read_excel to data_source object.
- Write the dataframe object with st.write. The dataframe displays correctly
- Download the file with st.download_button with the following code :
st.download_button(‘Download file’,data=pd.DataFrame.to_csv(data_source,index=False), mime=“text/csv”)
Results = I get a csv file but with encoding problems. When I open the file I get the following :
When I don’t specify a mime argument. it download as a .txt file and doesn’t give those encoding errors
I tried to export as a xlsx file also (which was the initual target) but it’s giving me a error message when I open the file so I swithced to csv.
Could you help ?