How to Create a CSV File
Learn how to create a CSV file in a text editor, escape commas and quotes, or export a spreadsheet as UTF-8 CSV.
Create a CSV in a text editor
Put column names on the first line and one record on each following line. Use the same field order throughout. Quote any value that contains a comma, a double quote, or a line break. Double any quote that appears inside a quoted value.
Name,ZIP code,Note
Maya Chen,02108,"Boston, MA"
Leo Ortiz,00501,"Said ""hello"""- Paste the sample into a plain-text editor.
- Save it as contacts.csv with UTF-8 encoding.
- Open it in the formatter and check that the preview shows 3 columns.
Export a spreadsheet as CSV
In Excel, choose Save As and select CSV UTF-8. In Google Sheets, choose File, Download, then Comma Separated Values. CSV represents one worksheet as text. Keep the workbook if you need its formatting or other sheets.