This is really a completely different question. It would probably be better to ask a new one. That gives the new question greater visibility and doesn’t place the onus on someone who thought about this material a month or so ago.
Having said that, if you’re trying to create a download button for your end user, you should probably use d3.csvParse and pass that result to DOM.download. Assuming your data is a list of objects, that might look like so:
download_button = {
let text = d3.csvFormat(data);
let file = new File([text], "file.csv");
return DOM.download(file, "file.csv", "Download CSV file");
}
On the other hand, if you’re just trying to grab some data as a CSV out of your notebook, you could use the “Download CSV” option from the vertical three dot menu on the left hand side of the cell.