CSV, or Comma-separated Values, is an extremely common flat-file format that uses commas as a delimiter between values. Anyone familiar with spreadsheet programs has very likely encountered CSV files before - they’re easily consumed by Google Spreadsheet, Microsoft Excel, and countless other applications.
CSV output will always start with the first row returning the column field names. Then the data itself will follow as CSV records.
Although the format is basically simple, there are a few rules you’ll need to follow:
Inflatable Elephant, Africanhas quotes around it because it contains a comma. Its description also is quoted, because it contains a newline.
"". For example, the quotes in
A "largish" mouseare doubled because they must be escaped.
null”, since CSV has no explicit way of describing a null value. For example,
nullfor the Inflatable Elephant.