yq/pkg/yqlib/doc/usage/headers/csv-tsv.md
Mike Farah c8815f5ab9
Csv decoder (#1290)
* WIP: adding CSV decoder

* Adding CSV decoder

* Added CSV roundtrip

* Fixing from review
2022-08-01 10:28:34 +10:00

594 B

CSV

Encode/Decode/Roundtrip CSV and TSV files.

Encode

Currently supports arrays of homogenous flat objects, that is: no nesting and it assumes the first object has all the keys required:

- name: Bobo
  type: dog
- name: Fifi
  type: cat

As well as arrays of arrays of scalars (strings/numbers/booleans):

- [Bobo, dog]
- [Fifi, cat]

Decode

Decode assumes the first CSV/TSV row is the header row, and all rows beneath are the entries. The data will be coded into an array of objects, using the header rows as keys.

name,type
Bobo,dog
Fifi,cat