CSVCSV GUIDE
Home›CSV Complete Guide›Creating and opening
Detail Guide 01 · Creating

How to Create a CSV File — and How to Open One

"How do I create a CSV file?" and "how do I open one?" are among the most searched CSV questions there are. This page walks through four ways to build a file and what to watch for when you open it, with every step tied to official documentation.

Updated October 30, 2026Reading time About 9 minSources Official documentation only
In short

Excel is the most common way to build one: File → Save As → "CSV UTF-8 (Comma delimited)". Two caveats — only one sheet is saved, and leading zeros disappear unless the column is formatted as text. Opening the result in Notepad remains the surest way to see what you actually wrote.

TOOLBuild and edit CSVs without leaving the browserEvery step described on this page can also be done directly in your browser.
Contents
  1. Choosing a method
  2. Creating in Excel
  3. Creating in a text editor
  4. Creating in Google Sheets
  5. Generating with code
  6. How to open a CSV
  7. Common mistakes and fixes
  8. Frequently asked questions
01Choosing

Which Method Should You Use?

How you create the file should follow from who opens it later, and in what software. Start with the overview.

MethodBest forEncodingWatch out for
ExcelBuilding a table quickly; you already work in Excel dailySelectable (UTF-8 recommended)One sheet only; leading zeros can vanish
Text editorA few lines of test data; strict control over encodingWhatever you chooseYou type everything by hand
Google SheetsSeveral people editing before you exportUTF-8 onlyCannot export Shift-JIS
CodeLarge datasets; scheduled generationWhatever you chooseYou have to write the code
Sources (checked October 30, 2026)
02Steps

Creating a CSV in Excel (the Most Common Route)

  1. Type the column names into row 1Name, Department, Notes — whatever your fields are. Leave no blank columns and no merged cells.
  2. Enter the dataFormulas are not saved; only the calculated values are written out.
  3. Choose File → Save As
  4. Set the file type to "CSV UTF-8 (Comma delimited)"This is the default choice in Excel 2016 and later, and Microsoft's own guide to save formats recommends the UTF-8 variant too.
  5. Pick a location and saveThe "some features will be lost" warning is normal for CSV. Click straight through it.
Two accidents that happen at save time

1. Only one sheet is saved. A CSV file holds exactly one sheet. Save a multi-sheet workbook as CSV and only the active sheet is written out.

2. Leading zeros and symbols disappear. "0012" is stored as the number 12. Format the column as text, or prefix the value with an apostrophe: '0012.

03Steps

Creating a CSV in a Text Editor

This is the right tool when the encoding has to be guaranteed, or when you only need a handful of test rows. In Windows Notepad you can choose the encoding from the dropdown when you save (see Microsoft's Notepad guide).

CSV (UTF-8)
product_code,product_name,unit_price,stock
A-001,Laptop,89800,12
A-002,"Mouse, wireless",2980,140
A-003,27-inch monitor,32800,7

Save with the .csv extension and UTF-8 encoding without a BOM. For web systems, that combination causes the fewest problems.

If you use VS Code

The status bar in the bottom right shows the encoding (UTF-8 / Shift-JIS) and the line endings (LF / CRLF). Add the Rainbow CSV extension and each column gets its own color, so a shifted column is obvious at a glance.

Sources (checked October 30, 2026)
04Steps

Creating a CSV in Google Sheets

  1. Build the tableThe advantage is that people can edit it together.
  2. File → Download → Comma-separated values (.csv)Only the sheet you currently have open is exported (Google's official steps).
  3. Check the encodingThe export is always UTF-8. If an internal system needs Shift-JIS, use the conversion steps on the garbled text page.
Sources (checked October 30, 2026)
05Steps

Generating a CSV with Code

For scheduled exports or large volumes, writing the file from code is the dependable option. With pandas it takes a single call: to_csv (official docs).

Python / pandas
import pandas as pd

df = pd.DataFrame([
{"product_code": "A-001", "product_name": "Laptop", "unit_price": 89800},
{"product_code": "A-002", "product_name": "Mouse", "unit_price": 2980},
])
# Forget index=False and you get an extra row-number column
# utf-8-sig (with a BOM) opens in Excel without garbled text
df.to_csv("products.csv", index=False, encoding="utf-8-sig")
06Viewing

How to Open a CSV File

Opening in Excel (when you want to work with the data)

Don't double-click. Go through Excel's Data → From Text/CSV instead. A double-click is precisely what eats leading zeros and turns long numbers into scientific notation (covered in detail on the conversion page).

Opening in Notepad or a text editor (when you want to see the raw data)

A CSV is plain text, so an editor shows the original characters exactly as stored. If double-clicking keeps dragging you into Excel, right-click → Open with → Notepad, then tick "Always use this app" and the editor will open it from then on.

An Excel icon is not a fault

Windows simply associates .csv with Excel. Either change the association, or use Open with each time.

Sources (checked October 30, 2026)
07Troubleshooting

Common Mistakes and How to Fix Them

SymptomCauseFix
Columns are shiftedA value containing a comma was not quotedWrap it in "…", following the quoting rules in RFC 4180
Leading zeros disappearThe value was read as a numberSet the column to Text during import
Dates changeAutomatic date conversionSame as above — make the column text
Garbled text on openEncoding mismatchThe three fixes on the garbled text page
Everything lands on one lineWrong line endings (classic Mac CR, for example)Re-save with LF or CRLF
Sources (checked October 30, 2026)
08FAQ

Frequently Asked Questions

Q.Does a CSV file have to use the .csv extension?

It is a convention rather than a rule. Most software will open .CSV in capitals, but for system integrations stick to lowercase .csv.

Q.Which encoding should I use when writing a CSV in Notepad?

UTF-8 for the web and for tool integrations, Shift-JIS (shown as ANSI in Notepad) for domestic core systems. Confirm what the receiving system expects.

Q.Can a CSV contain empty cells?

Yes. Two consecutive commas — value,,value — produce an empty cell between them. Trailing empty cells are handled the same way.

Q.Why won't other software open a CSV I made in Excel?

The encoding or the delimiter is the likely culprit. Open the file in Notepad first to see what is actually in it, then follow the steps on the garbled text page.

Q.How should I check the CSV I just created?

Open it in Notepad or VS Code and check the row count, column count, and quoting by eye. For large files, use Excel's status-bar count or count the lines in code.