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 on STDIN.
35
36          optional arguments:
37            -h, --help            show this help message and exit
38            -f FILETYPE, --format FILETYPE
39                                  The format of the input file. If not specified will be
40                                  inferred from the file type. Supported formats: csv,
41                                  dbf, fixed, geojson, json, ndjson, xls, xlsx.
42            -s SCHEMA, --schema SCHEMA
43                                  Specify a CSV-formatted schema file for converting
44                                  fixed-width files. See documentation for details.
45            -k KEY, --key KEY     Specify a top-level key to use look within for a list
46                                  of objects to be converted when processing JSON.
47            -n, --names           Display sheet names from the input Excel file.
48            --sheet SHEET         The name of the Excel sheet to operate on.
49            --write-sheets WRITE_SHEETS
50                                  The names of the Excel sheets to write to files, or
51                                  "-" to write all sheets.
52            -y SNIFF_LIMIT, --snifflimit SNIFF_LIMIT
53                                  Limit CSV dialect sniffing to the specified number of
54                                  bytes. Specify "0" to disable sniffing entirely.
55            -I, --no-inference    Disable type inference (and --locale, --date-format,
56                                  --datetime-format) when parsing CSV input.
57
58          Some command-line flags only pertain to specific input formats.
59
60       See also: ../common_arguments.
61
62       NOTE:
63          The “ndjson” format refers to “newline delimited JSON”, as  used  by
64          many streaming APIs.
65
66       NOTE:
67          If  an XLS looks identical to an XLSX when viewed in Excel, they may
68          not be identical as CSV. For example, XLSX has an integer type,  but
69          XLS  doesn’t.  Numbers that look like integers from an XLS will have
70          decimals in CSV, but those from an XLSX won’t.
71
72       NOTE:
73          To convert from HTML, consider messytables.
74

EXAMPLES

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

AUTHOR

108       Christopher Groskopf
109
111       2020, Christopher Groskopf
112
113
114
115
1161.0.4                            Jul 29, 2020                        IN2CSV(1)
Impressum