CSV file

<< Click to Display Table of Contents >>

Navigation:  Reference Manual > Files >

CSV file

A CSV Comma Separated Values (also know as comma delimited) file is a database or text file that has been laid out in the form of columns.  Each row contains data for one record.

CSV files are a convenient way to move data or text from one program to another if triple-s files are not available.

See also OpenXML file, Spreadsheet file and XML file.

The layout of a CSV tables output file can been found at https://netmr-download.scot/wp-content/uploads/2020/02/CSV-tables-layout.pdf.

A CSV file is a readable plain text file where each column is separated by a List separator or delimiter: usually a comma or a Tab character.

If the text within a cell contains any of the following:

the delimiter

a speech mark (")

a new line

then the text for that cell is surrounded by speech marks (").

If the text within a cell contains a speech mark then a double speech mark is used ("").

Any cell can be surrounded by speech marks even is it is not necessary and sometimes all cells in columns that contain text use them.

Header row

A CSV file should contain a header row as the first row which does not form a part of the data.  Each column in this first row contains a unique name that identifies the contents of the column.

Portable CSV

Note that other ways of reading single-coded and multi-coded are possible including text and multiple columns, see CSV type data file.

This is the CSV data file type used by Companion programs.  They are normal CSV files:

The Serial number is in a column (usually the first) with a heading of "Serial" or "IOBS"

Single-coded questions are stored as a response number

Multi-coded questions are stored as response numbers separated by spaces

Integer questions are stored as numbers, possibly with a leading - (minus), or U (undefined)

Float questions are stored as numbers, possibly with decimal places and a leading - (minus), or U (undefined)

Character and verbatim questions are stored as text

The default type of CSV file stored by the Companion is UTF-8 with BOM.

The Windows Notepad can be used to convert CSV files to another format using "Save as".

List separator

In some languages another character (not a comma) is used as the list separator.  The character used can be seen and changed in the Windows Control Panel section by selecting a language and viewing the Regional Options.

The program will only use the List separator character for non-Unicode CSV files.

Corrupted CSV files

If part of a CSV file is corrupted a number of lines of data may be lost because new lines within a cell (surrounded by speech marks) will be treated as part of the cell.  If the speech marks get out of synchronisation then a number of rows of data may be treated as one cell.