I want to create excel sheet from the 2-dimensional array.
I apologie for demanding code from scratch.
function downloadableCSV(rows) {
var content = "data:text/csv;charset=utf-8,";
rows.forEach(function(row, index) {
content += row.join(",") + "\n";
});
return encodeURI(content);
}
var rows = [
["name1", 2, 3],
["name2", 4, 5],
["name3", 6, 7],
["name4", 8, 9],
["name5", 10, 11]
];
$(document).ready(function(){
$("#download").click(function() {
downloadableCSV(rows);
});
});
I got this code from others fiddle. For any reason, the code seems not working.
Any help will be greatly appreciated. Thanks.