I am building an app with Dash plotly, and the app has the option to save a csv file (that create during the running time of the app), but I have problem with saving the csv file.
What I was trying to do is to use html.A
component, and set the href
attribute with this data:
csv_string = df.to_csv(encoding='utf-8', index=True)
csv_string = "data:text/csv;charset=utf-8," + urllib.parse.quote(csv_string)
the csv_string
is the data I assigned to href
attribute.
I saw someone recommended on this approach, and it's really seems to work.
The problem appeared when the Data frame is too big. When this happened there is a download error when trying to save the file.
Do you think I classified the problem correctly? Is it really possible to be a size problem?
What do you think I can do to fix this problem? is there any other solution for saving the file? I need to say that I don't want to download the file to static folder. I need to have solution that download the file to the default download folder of the user or enable the user to have the option to select the folder he would like to save the file into (with windows that pop up maybe).
Edit: I found this link: http://chandrewz.github.io/blog/downloading-large-csv-files-via-href that describe exactly the problem I have. Is there a solution similar to what the author suggest in Python?