A bit of a revision to this question:
I see from File Attachments that I can render CSV data by converting it to text, as follows:
named_cell = FileAttachment("example.csv").text()
But then to parse these data, I have to run d3.csvParse(named_cell)
.
Can I avoid the two-step process and do this in a single cell?
Neither of these attempts work:
d3.csvParse(FileAttachment("myFile.csv"))
d3.csv(FileAttachment("myFile.csv"))
I think the File Attachments notebook already has a suggestion for a one line solution, including an explanation why the await keyword is needed then. Are you looking for another option ?
1 Like
Yep, to reiterate the notebook you linked, it’s:
d3.csvParse(await FileAttachment("myFile.csv").text())
(And you can use d3.autoType if you’re so inclined.)
1 Like
Apologies for being totally blind, and thank you @andreasplesch and @mbostock.
Also, for convenience: d3-autotype [And wow! autotype is very handy!!]