I am writing a adove XD plugin. I am trying to save some data in a csv file and save it. But my code is not working.
const rows = [
["doc1", "layer1", "size1"],
["doc1", "layer2", "size2"]
];
const csvContent = `data:text/csv;charset=utf-8,${rows
.map((e) => e.join(","))
.join("n")}`;
const encodedUri = encodeURI(csvContent);
const link = document.createElement("a");
link.setAttribute("href", encodedUri);
link.setAttribute("download", "data.csv");
document.body.appendChild(link);
link.click()