jk icon indicating copy to clipboard operation
jk copied to clipboard

Support CSV files

Open alexec opened this issue 6 years ago • 3 comments

Can we read CSV files please?

alexec avatar Mar 26 '20 21:03 alexec

We do not provide specific support for CSV files at the moment, unfortunately. It's always possible to read a file as a string though, iterate over the lines and parse the fields in javascript.

I guess it could be somewhat possible to provide some built-in support, eg. transform a CSV file that looks like:

name,count
damien,2
michael,2

into something like

[{
    "name": "damien"
    "count": 2,
},{
    "name": "michael",
    "count": 2,
}]

but there's a lot of metadata to provide for this to work: column names, column types, field separator, ...

I'd lean towards writing that logic in js instead of providing built-in support /me thinks.

dlespiau avatar Mar 27 '20 10:03 dlespiau

I think there are probably good NPM libraries for CSV parsing. We have data we need to build out app from, being able to use CSV would mean we could only use JK.

alexec avatar Mar 27 '20 16:03 alexec

CSV (tab-SV, etc.) can be more complicated than it seems, with quoting and so on. It may be worth building this in (go has encoding/csv), perhaps as an RPC if not a std.Format.

squaremo avatar Mar 28 '20 18:03 squaremo