Hello, I like the idea of not to reload the page everytime you download something, but I just don't know how to use this feature.
So far I use this code to dowloand a csv, it works fine (if you ignore it realoads every single time):
with open("file.csv", "rb") as file:
st.download_button(
label='CSV cash alt',
data=file,
file_name="file.csv",
mime="text/csv")
Not sure how to implement this in download for a 'file.csv' that comes from an excel sheet (with variable sheet2)
with this code ste.download_button('CSV cash alt', sheet2, "file.csv") it sends an error page:
RuntimeError: Invalid binary data format: <class 'openpyxl.worksheet.worksheet.Worksheet'>
If I try something like this:
ste.download_button('CSV cash alt', "text/csv", "file.csv")
Gives me a file with literaly "text/csv" inside!
I hope you can guide me a bit, perhaps I'm not the only one lost in here.
Thank you for this breat idea, and not to reload the page again!
ste. download_button is implemented exactly the interface of st.download_button now, just replace any st.download_button to ste.download_button, that will make it works.
Hello, I like the idea of not to reload the page everytime you download something, but I just don't know how to use this feature. So far I use this code to dowloand a csv, it works fine (if you ignore it realoads every single time):
Not sure how to implement this in download for a 'file.csv' that comes from an excel sheet (with variable sheet2)
with this code
ste.download_button('CSV cash alt', sheet2, "file.csv")
it sends an error page:If I try something like this:
ste.download_button('CSV cash alt', "text/csv", "file.csv")
Gives me a file with literaly "text/csv" inside!I hope you can guide me a bit, perhaps I'm not the only one lost in here.
Thank you for this breat idea, and not to reload the page again!