🏠 back to Observable

FileAttachment now supports CSV (and TSV)

We’ve just shipped a change that makes it a little easier to read comma-separated values (CSV) in Observable:

data = FileAttachment("example.csv").csv()

No parser required!

The built-in CSV parser also supports automatic type inference if you set typed = true:

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? :thinking:

No bulk editing yet, but I definitely want it!


<looks at Mike’s published notebook count>

Huh, I have no idea why you’d be into that :stuck_out_tongue:


Thanks Mike! You’re killing it!

1 Like