How to Make a CSV File: Methods, Tools, and What to Know First

A CSV file — short for Comma-Separated Values — is one of the most universally compatible data formats in existence. Spreadsheet apps, databases, email marketing platforms, accounting software, and coding environments all read and write CSV. If you need to move structured data from one place to another, CSV is almost always a safe bet.

Here's how to create one, across every common method.

What a CSV File Actually Is

Before making one, it helps to understand the structure. A CSV file is a plain text file where each line represents a row of data, and each value within that row is separated by a comma. The first row is typically a header row — the column names.

A simple example:

Name,Email,City Alice,[email protected],Austin Bob,[email protected],Denver Carol,[email protected],Seattle 

That's it. No formatting, no formulas, no colors. Just raw values separated by commas. This simplicity is exactly why CSV works across so many platforms.

Method 1: Create a CSV in Microsoft Excel

Excel is the most common starting point for most people.

  1. Open a blank workbook
  2. Enter your column headers in Row 1
  3. Fill in your data in the rows below
  4. Go to File → Save As
  5. In the file format dropdown, select CSV (Comma delimited) (.csv)
  6. Click Save

Excel will warn you that some features (formatting, multiple sheets) won't be saved — that's expected. A CSV only stores values, not spreadsheet styling.

📌 Important: If your spreadsheet has multiple sheets, only the active sheet gets saved as CSV. Each sheet would need to be exported separately.

Method 2: Create a CSV in Google Sheets

Google Sheets makes this straightforward:

  1. Open a new or existing Google Sheet
  2. Enter your headers and data
  3. Go to File → Download → Comma-Separated Values (.csv)

The downloaded file contains only the current sheet. If you're working with multiple tabs, you'll need to export each one individually.

Google Sheets is particularly useful if you're collaborating with others before exporting — it's free, browser-based, and requires no software installation.

Method 3: Write a CSV File Manually in a Text Editor

Because CSV is plain text, you can create one in any text editor — Notepad on Windows, TextEdit on Mac, or any code editor like VS Code or Notepad++.

Steps:

  1. Open your text editor
  2. Type your headers on the first line, separated by commas
  3. Add each data row on its own line
  4. Save the file with a .csv extension (e.g., contacts.csv)

When saving in Notepad, change "Save as type" to All Files and manually type the .csv extension. Otherwise it may save as .txt.

Watch out for: commas inside your data values. If a value itself contains a comma (like "Smith, John"), wrap it in double quotes to prevent it from being misread as a column break. This is standard CSV convention.

Method 4: Export a CSV from Another Application 🗂️

Many tools generate CSV files directly:

SourceWhere to Find CSV Export
Gmail / Google ContactsContacts → Export → Google CSV
OutlookFile → Open & Export → Import/Export
ShopifyReports or Orders → Export
QuickBooksReports → Export to Excel/CSV
MySQL / PostgreSQLQuery results → Export as CSV
AirtableGrid view → Download CSV

If you're pulling data from a service or app, check its Export or Download option before building a CSV manually. Most platforms already support it.

Method 5: Generate a CSV Programmatically

If you're working with large datasets or automating a process, writing a CSV by hand isn't realistic. Most programming languages handle this natively.

Python (using the built-in csv module):

import csv with open('output.csv', 'w', newline='') as file: writer = csv.writer(file) writer.writerow(['Name', 'Email', 'City']) writer.writerow(['Alice', '[email protected]', 'Austin']) 

JavaScript (Node.js) and languages like R, Ruby, and PHP all have equivalent libraries or built-in functions for writing CSV output. This approach is standard when generating reports, data pipelines, or batch exports from databases.

Common CSV Gotchas Worth Knowing

Even a simple format has edge cases:

  • Encoding matters. Save your CSV as UTF-8 if it contains special characters (accented letters, non-Latin scripts). UTF-8 is the safest default for cross-platform compatibility.
  • Line endings vary. Windows uses , Unix/Mac uses . Most apps handle this automatically, but it can cause issues in some scripts or imports.
  • Not all "CSV" files use commas. Some regional settings (particularly in Europe) default to semicolons as the delimiter because commas are used as decimal separators. A file using semicolons is technically a DSV (delimiter-separated values) file, though it's often still called CSV.
  • Excel and dates. When you open a CSV in Excel, it sometimes auto-formats date and number fields in ways that alter the underlying value. If precision matters, import using Excel's Text Import Wizard rather than double-clicking the file.

What Determines Which Method Makes Sense for You

The right approach shifts depending on several factors: 🔍

  • How much data you're working with — a handful of rows is fine in a text editor; thousands of records call for a spreadsheet or script
  • Whether the data already exists somewhere — if it does, exporting is almost always faster than re-entering it
  • Your technical comfort level — text editors and spreadsheets need no coding knowledge; programmatic generation assumes some familiarity with scripting
  • How often you'll need to repeat this — a one-time export is different from an automated weekly report
  • What you're feeding the CSV into — some platforms have specific formatting requirements (exact column names, date formats, encoding types) that shape how you build the file

A CSV that works perfectly in one system can throw errors in another if the delimiter, encoding, or quoting conventions don't match what the receiving application expects. The format itself is simple — but what the destination expects from it adds a layer of specificity that's unique to each situation.