JS

JAVASCRIPT EXPORT ARRAY TO CSV FILE

(quick guide & example)

var array = [   ["Job", "job@doe.com", "123456"],   ["Joe", "joe@doe.com", "234567"],   ["Joi", "joi@doe.com", "345678"],   ["Jon", "jon@doe.com", "456789"],   ["Jou", "jou@doe.com", "987654"],   ["Joy", "joy@doe.com", "876543"] ];

DUMMY ARRAY

01

CREATE BLOB OBJECT var blob = new Blob([CSV.serialize(array)], {type: "text/csv"});

ARRAY TO CSV STRING

02

CREATE DOWNLOAD LINK var url = window.URL.createObjectURL (blob); var anchor = document.createElement("a"); anchor.href = url; anchor.download = "demo.csv";

DOWNLOAD CSV FILE

03

"FORCE DOWNLOAD" anchor.click(); window.URL.revokeObjectURL(url); anchor.remove();