Updated 2026-10-19 · By Sergi (spnfury)

How to create a CSV file: online, in Excel, Google Sheets, Notepad and Python

A CSV (comma-separated values) file is plain text: the first line holds the column names and every following line is one row, with the values separated by commas. Any program that saves text can create one, but each one has its own traps: Excel picks the separator from your regional settings, Notepad may add the wrong extension, and Google Sheets exports only the sheet you are looking at.

This guide shows the five most common ways to create a CSV file, which one to use for each situation, and how to check that the result will import cleanly into a database, an online shop, a CRM or a script.

Which method should you use?

MethodBest forWatch out for
Online CSV makerSmall files typed or pasted by hand, no software installedVery large data sets are better generated by a script
ExcelData that already lives in a spreadsheetSeparator follows regional settings; leading zeros and long numbers get changed
Google SheetsShared data, collaboration, quick exportsOnly the current sheet is exported
Notepad / TextEditTiny files, quick fixesExtension and encoding must be set by hand
PythonAutomation and large or repeated exportsOpen files with newline='' to avoid blank lines on Windows

Method 1: create a CSV file online with a CSV maker

The quickest way when you have no spreadsheet at hand, or when you want a file that is guaranteed to be comma-separated and UTF-8 regardless of your computer's settings.

  1. Open the CSV maker on the CSV Creator home page.
  2. Type the data in the table (one column per field, the first row as the header) or paste existing text into the text view.
  3. Give the file a name and click Download CSV. The file is saved as UTF-8 with commas and correct quoting.
  4. Nothing is uploaded: the file is built by your browser, so it also works with confidential data.

Open the CSV Maker

Method 2: save a CSV file from Excel

Excel writes the separator configured as "list separator" in your operating system. In the US, UK and Canada that is a comma; in most of continental Europe it is a semicolon. If the destination needs commas, either change the regional setting or create the file online instead.

Codes with leading zeros (ZIP codes, phone numbers, product codes) must be stored as text in Excel before saving, or the zeros are lost. Numbers longer than 15 digits, such as card or tracking numbers, are rounded unless they are text too.

  1. Put the column names in row 1 and one record per row below, starting in cell A1. Remove merged cells, totals and notes around the table.
  2. Go to File > Save As (File > Save a Copy in Microsoft 365) and choose a folder.
  3. In "Save as type" pick "CSV UTF-8 (Comma delimited) (*.csv)". Choose plain "CSV (Comma delimited)" only if the destination requires the legacy Windows encoding.
  4. Click Save and accept the warning that only the active sheet is saved and formatting is lost.

Method 3: download a CSV file from Google Sheets

Repeat the download for every tab you need: Google Sheets has no option to export all sheets to CSV at once. On a Mac, Apple Numbers works the same way through File > Export To > CSV.

  1. Open the spreadsheet and select the tab you want to export.
  2. Go to File > Download > Comma-separated values (.csv).
  3. The browser downloads the current sheet as a UTF-8 CSV with commas, named after the spreadsheet and the tab.

Method 4: write a CSV file in Notepad or TextEdit

  1. Open Notepad (Windows) or TextEdit (Mac). In TextEdit, choose Format > Make Plain Text first, or the file will be saved as rich text.
  2. Type the header line, for example: id,name,email
  3. Type one row per line with the values in the same order, separated by commas, without spaces after the commas.
  4. Save with a name ending in .csv. In Notepad set "Save as type" to "All files" and Encoding to UTF-8, so the file is not saved as data.csv.txt.
id,name,email,city
1,Ana Lopez,ana@example.com,"Austin, TX"
2,James O'Brien,james@example.com,Seattle

Method 5: create a CSV file with Python

For files generated by a program, use the csv module from the standard library, or pandas if the data is already in a DataFrame. Both handle quoting automatically.

import csv

rows = [
    ["id", "name", "city"],
    [1, "Ana Lopez", "Austin, TX"],
    [2, "James O'Brien", "Seattle"],
]
with open("data.csv", "w", newline="", encoding="utf-8") as f:
    csv.writer(f).writerows(rows)

# With pandas:
# df.to_csv("data.csv", index=False)

Rules every CSV file should follow

How to check the file before importing it

Open the CSV in a viewer that shows the columns as the importer will see them, rather than in Excel, which silently reformats dates and numbers. The CSV viewer and editor on this site shows the detected separator, encoding and column count, and highlights rows that do not fit.

CSV Viewer and Editor

Frequently asked questions

How do I make a CSV file without Excel?

Use an online CSV maker, Google Sheets or a plain text editor. With an online CSV maker you type or paste the data and download a UTF-8, comma-separated file in one click, without installing anything.

Why does my CSV from Excel use semicolons instead of commas?

Excel uses the list separator of your regional settings, which is a semicolon in most European countries because the comma is the decimal separator there. Change the list separator in your operating system's region settings, or create the CSV with a tool that always uses commas.

What is the difference between CSV and CSV UTF-8 in Excel?

Both are comma-separated text files. "CSV UTF-8" saves the text as UTF-8, so accents and non-Latin characters are kept; plain "CSV" uses the legacy Windows encoding of your system, which can turn those characters into question marks in other programs.

Can a CSV file have more than one sheet?

No. A CSV file is a single table of plain text. To export a workbook with several sheets, save each sheet as its own CSV file, or keep the data as .xlsx.

How big can a CSV file be?

The format itself has no limit, but programs do: Excel opens at most 1,048,576 rows per sheet. Larger files can be opened with a large CSV viewer or processed with a database or a script.

Related tools