Skip to content
FormatMyCSV

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"""
  1. Paste the sample into a plain-text editor.
  2. Save it as contacts.csv with UTF-8 encoding.
  3. 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.

Open the CSV formatter

Frequently asked questions

How do I create a CSV file?

Write one record per line in a plain-text editor and separate fields with commas. Add column names on the first line if needed, then save the file with a .csv extension and UTF-8 encoding. Open it in the CSV formatter to confirm that the fields line up.

What type of CSV to use?

Choose UTF-8 CSV with comma separators unless the importing app specifies another format. Use consistent columns in every row, and add a header if the app expects labels. Before writing the whole file, try a small sample in the destination, including any accented names or special characters.

How to convert Excel to CSV

In Excel, select the worksheet, choose Save As, and pick CSV UTF-8 where available. This saves the active sheet as text. If you prefer to process a workbook within your browser, use Excel to CSV to export its first sheet. FormatMyCSV never uploads the workbook.

How do I include a comma or quote in a CSV value?

Wrap a value containing a comma, quote, or line break in double quotes. Double each quote that belongs inside the value. For example, write “Boston, MA” with straight double quotes in the file so the city and state remain together as one field when the row is read.

How do I make sure my new CSV opens correctly?

Check the separator, header, and values in the CSV viewer. Test a row with punctuation and another with any accented characters your data uses. The preview runs in your browser, and the file is never uploaded. If Excel is the destination, check how it imports identifier columns too.