What Is a Comma Delimited Text File?

A comma delimited text file is a plain text file that contains tablular data. Each line of the file represents a single record. The values for each record are separated by a comma. Comma delimited text files are commonly called Comma Separated Value files. These files are used to pass data from one software program to another or to pass data from one computer to another.

  1. Format

    • The following is an example of a CSV file:

      FName,LName,email
      Fred,Astaire,dancer@example.com
      Ginger,Rogers,hotdancer@example.com
      Mark,Twain,goodwriter@example.com

      There is no standard but all CSV files are delimited by some type of separator and each record is separated by a new line character. If there the separator or a new line is embedded in one of the field, the separator or new line must be escaped.

    Separators

    • CSV files can be separated by a comma, a pipe symbol (|), a period (.), a semicolon (;), a colon (:) or another special character. The separator must be the same for all fields. Not all programs that understand CSV files will accept all separator types. Changing the separator reduces the need for some fields to be escaped. For example, if the data includes numbers in the format "1,234," you can change the separator and the field no longer needs to be escaped.

    Escaping Characters

    • Special characters such as separator characters or new line characters, embedded in fields must be escaped for the fields to be read correctly. Some programs, such as Microsoft Excel, enclose these lines in a set of double quotes ("). Unix style programs place a backslash (\) before the special character and use the C-style new line indicator (\r or \n).

    Uses

    • CSV files are used to transfer data. Most spreadsheet programs and databases have the ability to export and import CSV data. Many address book (contact) programs can export and import CSV data. The data is in a plain text file, so it can be read by most programming languages. Care should be used when using CSV files with sensitive data as the files are not encrypted in any way.

Related Searches:

References

Comments

Related Ads

Featured