data = FileAttachment("example.csv").csv({typed: true})
If you don’t want to treat the first row as a header row of column names, you can set array = true:
data = FileAttachment("example.csv").csv({array: true})
There’s a file.tsv() method for tab-separated values, too.
We’ve updated the File Attachments notebook accordingly, and we’re in the process of updating notebooks to demonstrate this new feature. Hope you find it useful!
Thanks Mike! I’m curious to know how you’re updating example notebooks following a change such as this, or the move to D3 6.0. Is there any bulk editing functionality in the works?
Is there a way to have more control on the types passed?
My CSV data has a date that is just a year as a string and using {typed: true} it turns it into a number, which then causes formatting issues when used with Table
I am hoping to find out the I can do something like:
nitrateData = FileAttachment("nitrate_leaching.csv").csv({types: string , string, string, date, number })