Chrome cannot export to csv if there are too many rows? Chrome cannot export to csv if there are too many rows? google-chrome google-chrome

Chrome cannot export to csv if there are too many rows?


Chrome can only handle HREF's that are roughly 2 million characters long (or less).

You want to add the output to a Blob and then on that blob create an ObjectURL using URL.createObjectURL (MDN) and attach that to the href attribute of the anchor.

An example might be:

var csvContent = "";data.forEach(function (infoArray, index) {    dataString = infoArray.join(",");    csvContent += dataString + "\n";});var blobdata = new Blob([csvContent],{type : 'text/csv'});var link = document.createElement("a");link.setAttribute("href", window.URL.createObjectURL(blobdata));link.setAttribute("download", "Data.csv");document.body.appendChild(link);link.click();