Download raw data


It is the case. Thanks @chriddyp
I was using chrome to do the test. I was able to download the csv file up to 1328KB but fail with the csv file of size 1655KB. I guess it’s because the js link that the urllib generates introduce some overhead.
Tried firefox just now and it was able to download the csv file of size 7.8MB with no problem. Didn’t have chance to try larger data.

Allowing users to download CSV on click

the URI specs are very useful, thanks!


That’s why, excellent, thanks!


Here is another approach that works for larger files:

Exporting data filtered based on user interaction in the GUI

Hi @chriddyp and @pray,

I’m still having this same issue, even when I import urllib.parse instead of urllib.

I just copied/pasted the example, and the download link returns the same csv of html.

What else can I check or troubleshoot to understand what’s going on?


Hm, I’m not sure why this isn’t working. You haven’t made any changes to the example that I posted above?

Which browser are you on?

Try inspecting the <a/> element that is rendered on the page, in particular its href property. The href property should be updated from the callback. Here’s what it looks like for me:


Thanks for the suggestions. Yes, I only copied/pasted exactly what you wrote above. I’ve tried it in Firefox 57.0 and Chrome Version 61.0.3163.100 on Ubuntu 16.04

I checked, my href property is empty, so it’s not being updated from the callback? What can I do about that?


Weird, I don’t know why this isn’t uploading.

You could also check:

  • Do data URIs work at all for you or are they for some reason blocked by your machine? I made this example for you to test:
  • Is the callback updating? You can add a print statement inside the callback to check if it’s being called.
  • You can also inspect your network console to see if the HTTP request is responding correctly. Here is a screenshot of the request, it will be the second _dash-udpate-component request and the payload will have a JSON object with {"response": {"props": {"href": "data:text/csv;...."}}}
  • Are there any errors in the console?


Hi juakali,

in addition to chris’’ notes:

Do you have the following statement in your code?:

When I had problems with callbacks that are not updating, I wasn’t able to debug, because of my own settings. Set to “False” to receive an error when trying to call a callback.

Kind regards



A post was split to a new topic: Dash DataTable - Downloading Selected Rows


Hi @Stuart_Kerkhof and @chriddyp,

Thanks for your help and the examples, much appreciated. I forgot to update my solution but in the end it was a very small thing - I’m using Python 3 and needed to replace urllib.quote with urllib.parse.quote


I noticed the data URI works in Chrome if you remove href="_blank".


2 questions:
1- can one download links save several files at once… say i want to split the table into two and save both halves as separate files?
2- can i change the path the file is getting saved to?


@chriddyp @carlottanegri Is it possible to change encoding? Excel will automatically open csv link, but encoding is incorrectly. I have to manually use txt to change encoding into ansi, and reopen with excel. I also tried to modify ‘utf-8’ to ‘ansi’. But it does not work… any suggestion?