CSV FILE FORMAT

CSV FORMAT

A comma-separated values (CSV) file is a delimited text file that uses a comma to separate values. Each line of the file is a data record.

Comma-separated values.

Filename extension.csv
Type of formatmulti-platform, serial data streams
Container fordatabase information organized as field separated lists
StandardRFC 4180

CSV Format Is Use

A CSV is a comma-separated values file, which allows data to be saved in a tabular format. CSVs look like a garden-variety spreadsheet but with a . csv extension. CSV files can be used with most any spreadsheet program, such as Microsoft Excel or Google Spreadsheets.

Here are the rules for creating CSV files:

  1. Separate data fields with a delimiter, usually a comma. This should be a single character. If you do not want to use a comma, you should choose something like a tab or a pipe (|) character.
  2. Keep each record on a separate line. Each record must start on its own line, but a single record can span multiple lines.
  3. Do not follow the last record in a file with a carriage return.
  4. In the first line of the file, include a header with a list of the column names in the file. This is optional, but strongly recommended; it allows the file to be self-documenting.
  5. Make sure the header list is delimited in the same way as the rest of the file. This helps guard against the data fields being transposed in the data when it is loaded, which can lead to getting wrong answers when you query the data.
  6. Remember that the enclosing character (typically double quotes) must be used when required, such as when the delimiter appears in a field.

For more detail on these rules, you can look at Wikipedia and RFC 4180 (the Request for Comments document in the CSV specification).

Difference Between CSV file and Excel?

CSV and Excel or xls are two different types of file extensions which both contain data in them, the difference between the both is that in CSV or comma-separated values the data is in text format separated by commas while in excel or Xls data is in tabular format or we say in rows and columns and in CSV file extension …

CSV file example

CSV is a delimited text file that uses a comma to separate values (many implementations of CSV import/export tools allow other separators to be used; for example, the use of a “Sep=^” row as the first row in the *.csv file will cause Excel to open the file expecting caret “^” to be the separator instead of comma “,”).

Follow Me

If you like my post please follow me to read my latest post on programming and technology.

Instagram

Facebook

Recent Posts

Generate Parenthesis | Intuition + Code | Recursion Tree | Backtracking | Java

Problem Statement: Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. Example…

3 months ago

Square Root of Integer

Given an integer A. Compute and return the square root of A. If A is…

1 year ago

Build Array From Permutation

Given a zero-based permutation nums (0-indexed), build an array ans of the same length where…

1 year ago

DSA: Heap

A heap is a specialized tree-based data structure that satisfies the heap property. It is…

2 years ago

DSA: Trie

What is a Trie in DSA? A trie, often known as a prefix tree, is…

2 years ago

Trees: Lowest Common Ancestor

What is the Lowest Common Ancestor? In a tree, the lowest common ancestor (LCA) of…

2 years ago