1IN2CSV(1)                           csvkit                           IN2CSV(1)
2
3
4

NAME

6       in2csv - in2csv Documentation
7

DESCRIPTION

9       Converts various tabular data formats into CSV.
10
11       Converting fixed width requires that you provide a schema file with the
12       “-s” option. The schema file should have the following format:
13
14          column,start,length
15          name,0,30
16          birthday,30,10
17          age,40,3
18
19       The header line is required though the columns may be in any order:
20
21          usage: in2csv [-h] [-d DELIMITER] [-t] [-q QUOTECHAR] [-u {0,1,2,3}] [-b]
22                        [-p ESCAPECHAR] [-z FIELD_SIZE_LIMIT] [-e ENCODING] [-L LOCALE]
23                        [-S] [--blanks] [--date-format DATE_FORMAT]
24                        [--datetime-format DATETIME_FORMAT] [-H] [-K SKIP_LINES] [-v]
25                        [-l] [--zero] [-V] [-f FILETYPE] [-s SCHEMA] [-k KEY] [-n]
26                        [--sheet SHEET] [--write-sheets WRITE_SHEETS]
27                        [--encoding-xls ENCODING_XLS] [-y SNIFF_LIMIT] [-I]
28                        [FILE]
29
30          Convert common, but less awesome, tabular data formats to CSV.
31
32          positional arguments:
33            FILE                  The CSV file to operate on. If omitted, will accept
34                                  input as piped data via STDIN.
35
36          optional arguments:
37            -h, --help            show this help message and exit
38            -f {csv,dbf,fixed,geojson,json,ndjson,xls,xlsx}, --format {csv,dbf,fixed,geojson,json,ndjson,xls,xlsx}
39                                  The format of the input file. If not specified will be
40                                  inferred from the file type.
41            -s SCHEMA, --schema SCHEMA
42                                  Specify a CSV-formatted schema file for converting
43                                  fixed-width files. See web documentation.
44            -k KEY, --key KEY     Specify a top-level key to look within for a list of
45                                  objects to be converted when processing JSON.
46            -n, --names           Display sheet names from the input Excel file.
47            --sheet SHEET         The name of the Excel sheet to operate on.
48            --write-sheets WRITE_SHEETS
49                                  The names of the Excel sheets to write to files, or
50                                  "-" to write all sheets.
51            --encoding-xls ENCODING_XLS
52                                  Specify the encoding of the input XLS file.
53            -y SNIFF_LIMIT, --snifflimit SNIFF_LIMIT
54                                  Limit CSV dialect sniffing to the specified number of
55                                  bytes. Specify "0" to disable sniffing.
56            -I, --no-inference    Disable type inference (and --locale, --date-format,
57                                  --datetime-format) when parsing CSV input.
58
59          Some command-line flags only pertain to specific input formats.
60
61       See also: Arguments common to all tools.
62
63       NOTE:
64          The “ndjson” format refers to “newline delimited JSON”, as  used  by
65          many streaming APIs.
66
67       NOTE:
68          If  an XLS looks identical to an XLSX when viewed in Excel, they may
69          not be identical as CSV. For example, XLSX has an integer type,  but
70          XLS  doesn’t.  Numbers that look like integers from an XLS will have
71          decimals in CSV, but those from an XLSX won’t.
72
73       NOTE:
74          To convert from HTML, consider messytables.
75

EXAMPLES

77       Convert the 2000 census geo headers file from fixed-width  to  CSV  and
78       from latin-1 encoding to utf8:
79
80          in2csv -e iso-8859-1 -f fixed -s examples/realdata/census_2000/census2000_geo_schema.csv examples/realdata/census_2000/usgeo_excerpt.upl
81
82       NOTE:
83          A library of fixed-width schemas is maintained in the ffs project:
84
85          https://github.com/wireservice/ffs
86
87       Convert an Excel .xls file:
88
89          in2csv examples/test.xls
90
91       Standardize the formatting of a CSV file (quoting, line endings, etc.):
92
93          in2csv examples/realdata/FY09_EDU_Recipients_by_State.csv
94
95       Fetch  csvkit’s  open  issues from the GitHub API, convert the JSON re‐
96       sponse into a CSV and write it to a file:
97
98          curl https://api.github.com/repos/wireservice/csvkit/issues?state=open | in2csv -f json -v
99
100       Convert a DBase DBF file to an equivalent CSV:
101
102          in2csv examples/testdbf.dbf
103
104       This tool names unnamed headers. To avoid that behavior, run:
105
106          in2csv --no-header-row examples/test.xlsx | tail -n +2
107

AUTHOR

109       Christopher Groskopf
110
112       2022, Christopher Groskopf
113
114
115
116
1171.0.7                            Jul 22, 2022                        IN2CSV(1)
Impressum