CSVLOOK(1)

✨ csvlook πŸ’…

okay so bestie, this is csvlook β€” part of the csvkit crew β€” and it's literally the glow-up your boring CSV file has been waiting for. no cap.


🌸 NAME 🌸

csvlook β€” the csvkit tool that makes your CSV look cute on the command line. this is its documentation, periodt.


πŸŽ€ DESCRIPTION πŸŽ€

It renders a CSV to the command line in a Markdown-compatible, fixed-width format. like, your spreadsheet but it ate and left no crumbs.

usage: csvlook [-h] [-d DELIMITER] [-t] [-q QUOTECHAR] [-u {0,1,2,3}] [-b]
               [-p ESCAPECHAR] [-z FIELD_SIZE_LIMIT] [-e ENCODING] [-L LOCALE]
               [-S] [--blanks] [--null-value NULL_VALUES [NULL_VALUES ...]]
               [--date-format DATE_FORMAT] [--datetime-format DATETIME_FORMAT]
               [-H] [-K SKIP_LINES] [-v] [-l] [--zero] [-V]
               [--max-rows MAX_ROWS] [--max-columns MAX_COLUMNS]
               [--max-column-width MAX_COLUMN_WIDTH]
               [--max-precision MAX_PRECISION] [--no-number-ellipsis]
               [-y SNIFF_LIMIT] [-I]
               [FILE]

Render a CSV file in the console as a Markdown-compatible, fixed-width table.

positional arguments:
  FILE                  The CSV file to operate on. If omitted, will accept
                        input as piped data via STDIN.

optional arguments:
  -h, --help            show this help message and exit
  --max-rows MAX_ROWS   The maximum number of rows to display before
                        truncating the data.
  --max-columns MAX_COLUMNS
                        The maximum number of columns to display before
                        truncating the data.
  --max-column-width MAX_COLUMN_WIDTH
                        Truncate all columns to at most this width. The
                        remainder will be replaced with ellipsis.
  --max-precision MAX_PRECISION
                        The maximum number of decimal places to display. The
                        remainder will be replaced with ellipsis.
  --no-number-ellipsis  Disable the ellipsis if --max-precision is exceeded.
  -y SNIFF_LIMIT, --snifflimit SNIFF_LIMIT
                        Limit CSV dialect sniffing to the specified number of
                        bytes. Specify "0" to disable sniffing entirely, or
                        "-1" to sniff the entire file.
  -I, --no-inference    Disable type inference (and --locale, --date-format,
                        --datetime-format, --no-leading-zeroes) when parsing
                        the input.

okay now let's talk about the ~situation~ πŸ’–

πŸ”₯ the vibes, explained

  • FILE β€” the CSV file you want it to operate on. if you don't give it one, it'll just accept input as piped data via STDIN. she's flexible like that 🫢
  • -h, --help β€” shows this help message and dips. iconic behaviour.
  • --max-rows MAX_ROWS β€” the max number of rows to display before it starts truncating the data. too long, didn't read, literally.
  • --max-columns MAX_COLUMNS β€” same energy but for columns: the max number of columns to display before truncating the data.
  • --max-column-width MAX_COLUMN_WIDTH β€” truncates all columns to at most this width. whatever's left over gets replaced with an ellipsis. she's editing. βœ‚οΈ
  • --max-precision MAX_PRECISION β€” the max number of decimal places to display. the remainder gets replaced with ellipsis.
  • --no-number-ellipsis β€” turns off the ellipsis if --max-precision gets exceeded. no dots for you.
  • -y SNIFF_LIMIT, --snifflimit SNIFF_LIMIT β€” limits CSV dialect sniffing to the specified number of bytes. set it to "0" to disable sniffing entirely, or "-1" to sniff the entire file. she's thorough πŸ‘‘
  • -I, --no-inference β€” disables type inference (and --locale, --date-format, --datetime-format, --no-leading-zeroes) when parsing the input.

if a table is too wide to display properly, bestie, try piping the output to less -S or truncating it using csvcut.

if the table is too long? try filtering it down with grep, or pipe the output to less.

See also: Arguments common to all tools.

NOTE: the fractional part of a decimal numberal is always truncated. to control this truncation, use --no-inference along with --max-column-width.

πŸ’– EXAMPLES πŸ’–

basic use, the classic, the blueprint:

csvlook examples/testfixed_converted.csv

this tool is especially useful as a final operation when you're piping through other tools. the way that she closes out the pipeline… πŸ’…

csvcut -c 9,1 examples/realdata/FY09_EDU_Recipients_by_State.csv | csvlook

if a data row contains more cells than the header row, csvlook will error. use csvclean to remove such rows. (not the vibe, but okay.)

to ignore the extra cells instead:

csvcut -C "" examples/bad.csv | csvlook

if those rows are at the top of the file (like, copyright notices, very boring), you can skip the rows:

csvlook --skip-lines 1 examples/bad.csv

this error can also happen if csvlook incorrectly deduces ("sniffs") the CSV format πŸ™ˆ. to disable CSV sniffing, set --snifflimit 0 and then, if necessary, set the --delimiter and --quotechar options yourself. or, set --snifflimit -1 to use the entire file as the sample, instead of the first 1024 bytes.


πŸ¦‹ AUTHOR πŸ¦‹

Christopher Groskopf and contributors 🌟 (legends, honestly)

2016, Christopher Groskopf and James McKinney


and that's the whole page, bestie β€” written by the csvkit girlies, version 2.2.0, dated Aug 16, 2024. slay, bye πŸ’–βœ¨

πŸ“¦ where this page comes from