to csv for formats
Convert table into .csv text .
Signature
> to csv {flags}
Flags
-
--separator, -s {string}: A character to separate columns, defaults to ','. -
--noheaders, -n: Do not output the columns names as the first row. -
--columns {list<string>}: The names (in order) of the columns to use.
Input/output types:
| input | output |
|---|---|
| record | string |
| table | string |
Examples
Outputs a CSV string representing the contents of this table.
> [[foo bar]; [1 2]] | to csv foo,bar 1,2
Outputs a CSV string representing the contents of this table.
> [[foo bar]; [1 2]] | to csv --separator ';' foo;bar 1;2
Outputs a CSV string representing the contents of this record.
> {a: 1 b: 2} | to csv
a,b
1,2Outputs a CSV stream with column names pre-determined.
> [[foo bar baz]; [1 2 3]] | to csv --columns [baz foo] baz,foo 3,1
Copyright © 2019–2026 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/to_csv.html