nushell/docs/commands/from.md
Bruno Heridet 6826a9aeac
doc: add more from command pages (#1778)
* doc: add from-url command page

* doc: add missing link to existing from-xml page.

* doc: add from-ini command page
2020-05-14 05:23:33 +12:00

1.6 KiB

from-csv

Converts content (string or binary) into a table. The source format is specified as a subcommand, like from csv or from json.

Use this when nushell cannot determine the input file extension.

Available Subcommands

Subcommands without links are currently missing their documentation.

Example for from csv

Let's say we have the following file :

> cat pets.txt
animal, name, age
cat, Tom, 7
dog, Alfred, 10
chameleon, Linda, 1

pets.txt is actually a .csv file but it has the .txt extension, open is not able to convert it into a table :

> open pets.txt
animal, name, age
cat, Tom, 7
dog, Alfred, 10
chameleon, Linda, 1

To get a table from pets.txt we need to use the from csv command:

> open pets.txt | from csv
━━━┯━━━━━━━━━━━┯━━━━━━━━━┯━━━━━━
 # │ animal    │  name   │  age
───┼───────────┼─────────┼──────
 0 │ cat       │  Tom    │  7
 1 │ dog       │  Alfred │  10
 2 │ chameleon │  Linda  │  1
━━━┷━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━