SaveAs Dialog on Download Button

I want to download a pandas dataframe as a .csv file, but I want to prompt the user with an OpenFile Dialog in order to select the directory and filename to save the content to. Is there any way to do this in Streamlit?

It is up to the user to decide how to handle downloads by configuring their browser.

Can’t I force the browser to always ask for a location?

If you mean other people’s browsers, I don’t think so.

What would be the point anyway? As I see it, downloading from your application shouldn’t be different than downloading from any other web site, otherwise users would be confused.

Here’s one way to do it, with some custom javascript using the showSaveFilePicker (which isn’t supported by all browsers)

https://playground.streamlit.app?q=4eb207

Thanks! I think this is exactly what I was looking for!