2020-07-13 08:39:36 +02:00
|
|
|
# from csv
|
2020-05-04 23:01:31 +02:00
|
|
|
|
2020-05-05 10:05:23 +02:00
|
|
|
Converts content (string or binary) into a table. The source format is specified as a subcommand, like `from csv` or `from json`.
|
2020-05-04 23:01:31 +02:00
|
|
|
|
|
|
|
Use this when nushell cannot determine the input file extension.
|
|
|
|
|
|
|
|
## Available Subcommands
|
|
|
|
|
2020-05-05 10:05:23 +02:00
|
|
|
* from bson
|
2020-05-04 23:01:31 +02:00
|
|
|
* [from csv](from-csv.md)
|
2020-05-05 10:05:23 +02:00
|
|
|
* from eml
|
2020-05-04 23:01:31 +02:00
|
|
|
* [from ics](from-ics.md)
|
2020-05-13 19:23:33 +02:00
|
|
|
* [from ini](from-ini.md)
|
2020-05-04 23:01:31 +02:00
|
|
|
* [from json](from-json.md)
|
|
|
|
* [from ods](from-ods.md)
|
2020-05-05 10:05:23 +02:00
|
|
|
* from sqlite
|
|
|
|
* from ssv
|
2020-05-04 23:01:31 +02:00
|
|
|
* [from toml](from-toml.md)
|
|
|
|
* [from tsv](from-tsv.md)
|
2020-05-13 19:23:33 +02:00
|
|
|
* [from url](from-url.md)
|
2020-05-04 23:01:31 +02:00
|
|
|
* [from vcf](from-vcf.md)
|
2020-05-05 10:05:23 +02:00
|
|
|
* [from xlsx](from-xlsx.md)
|
2020-05-13 19:23:33 +02:00
|
|
|
* [from xml](from-xml.md)
|
2020-05-04 23:01:31 +02:00
|
|
|
* [from yaml](from-yaml.md)
|
|
|
|
|
2020-05-05 10:05:23 +02:00
|
|
|
*Subcommands without links are currently missing their documentation.*
|
|
|
|
|
2020-05-04 23:01:31 +02:00
|
|
|
## Example for `from csv`
|
|
|
|
|
2020-06-23 20:21:47 +02:00
|
|
|
Let's say we have the following file:
|
2020-05-04 23:01:31 +02:00
|
|
|
|
|
|
|
```shell
|
|
|
|
> cat pets.txt
|
|
|
|
animal, name, age
|
|
|
|
cat, Tom, 7
|
|
|
|
dog, Alfred, 10
|
|
|
|
chameleon, Linda, 1
|
|
|
|
```
|
|
|
|
|
2020-06-23 20:21:47 +02:00
|
|
|
`pets.txt` is actually a .csv file but it has the .txt extension, `open` is not able to convert it into a table:
|
2020-05-04 23:01:31 +02:00
|
|
|
|
|
|
|
```shell
|
|
|
|
> 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:
|
|
|
|
|
|
|
|
```shell
|
|
|
|
> open pets.txt | from csv
|
|
|
|
━━━┯━━━━━━━━━━━┯━━━━━━━━━┯━━━━━━
|
|
|
|
# │ animal │ name │ age
|
|
|
|
───┼───────────┼─────────┼──────
|
|
|
|
0 │ cat │ Tom │ 7
|
|
|
|
1 │ dog │ Alfred │ 10
|
|
|
|
2 │ chameleon │ Linda │ 1
|
|
|
|
━━━┷━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━
|
|
|
|
```
|