CSVfox
Leverage Your Data.
 English

±colnames, ±c

Defining whether the csv file has a header line containing the column names

Description

-c Defines whether the first line of the CSV file will be interpreted as containing the column names.
+c Sets or inhibits the output if a column header line when writing a CSV file.

If the input file does not contain column names, there will be also no column names written to the output file, even if +c is enabled.
(Todo: maybe just use Column Numbers as names in this case, and let user "rename" the columns?)

Per default csvfox is assuming that the first row contains column names in all files (-c=y, +c=y). As a parameter for this setting "y", "yes", "true", or "1" will be accepted, as well as "n", "no", "false", or "0". Upper/Lower case will be ignored.

Pattern

±c=truthvalue ±colnames=truthvalue

Usage Examples

In the following examples, the column header line will have a colored background. So you can easily see which CSV tables have column names, and which have none.

csvfox inputfile.csv
csvfox inputfile.csv -colnames=Yes
Assumes that the CSV file to read (inputfile.csv) has column names in the first row. This is default behaviour:
inputfile.csv
SeasonGreenCarDays
springflowersbicycle91
summerfruitscabriolet92
autumncolorful leaveslimousine92
wintersnowy twigssled90
csvfox inputfile.csv -c=N
Assumes that the CSV file to read (inputfile.csv) does not have column names in the first row (this will misinterpret an existing header line to be the first data row!):
inputfile.csv
SeasonGreenCarDays
springflowersbicycle91
summerfruitscabriolet92
autumncolorful leaveslimousine92
wintersnowy twigssled90
csvfox inputfile.csv -c=yes +c=N outputfile.csv
Assumes that the CSV file to read (inputfile.csv) has column names in the first row, while the CSV file to write (outputfile.csv) will have them omitted.
In other words, this removes the header line with the column names.
inputfile.csv
SeasonGreenCarDays
springflowersbicycle91
summerfruitscabriolet92
autumncolorful leaveslimousine92
wintersnowy twigssled90
outputfile.csv
springflowersbicycle91
summerfruitscabriolet92
autumncolorful leaveslimousine92
wintersnowy twigssled90
This might be necessary if the target application cannot work with a column header line, or when the output data rows are to be appended to an existing CSV file with identical structure.
If a CSV file has no column header line and therefore no column names, you obviously cannot access it's fields by name. Addressing of the CSV fields by number [1]-[9][10]-[99] etc., or in Excel notation [A]-[Z][AA]-[AZ] etc. is still supported.
Under construction, coming soon