Skip to content

Instantly share code, notes, and snippets.

Created Jul 26, 2015
What would you like to do?
A way to generate and download CSV files client-side
var blob = new Blob([csvString]);
if (window.navigator.msSaveOrOpenBlob) // IE hack; see
window.navigator.msSaveBlob(blob, "filename.csv");
var a = window.document.createElement("a");
a.href = window.URL.createObjectURL(blob, {type: "text/plain"}); = "filename.csv";
document.body.appendChild(a);; // IE: "Access is denied"; see:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment