There is more than one way to create a CSV file, and the right method depends on how much data you have and how it originates. Here are the four most common approaches, with the trade-offs of each.
Method 1: Create a CSV from a spreadsheet
The most familiar route is to build the data in Excel, Google Sheets or another spreadsheet application and export it:
- Put each column name in the first row (the header).
- Enter one record per row underneath.
- Use File → Save As / Download → CSV. In Excel choose "CSV UTF-8 (Comma delimited)" — the plain "CSV" option may save with an encoding that breaks special characters.
Watch out for:
- Spreadsheet auto-formatting can mangle data: SKUs like
00123lose leading zeros, dates get reformatted, and long numbers turn into scientific notation. - Formulas are exported as their calculated values — that is usually what you want, but verify.
- Multiple sheets are not saved — only the active sheet becomes the CSV.
Method 2: Create a CSV in a plain text editor
For small files, any text editor works. Type the header row, then one line per record, separating values with commas:
product,price,category
Espresso,120,Beverages
Cappuccino,160,Beverages
Blueberry Muffin,90,BakerySave the file with a .csv extension, encoded as UTF-8.
Watch out for: values that contain commas must be wrapped in double quotes, and every row must have exactly the same number of values as the header.
Method 3: Create a CSV with code
For developers, generating CSV programmatically is often the most reliable route. Most languages have a built-in or standard CSV library that handles quoting and escaping correctly — always prefer a real CSV library over joining strings with commas, because the library handles the edge cases (quotes inside values, newlines in fields) for you.
Method 4: Create a CSV with AI
If the data does not exist yet — a product catalog, a menu, a list of test records — you can describe what you need and let an AI tool build it. With CSV Pilot you type something like "create 10 grocery products for an organic store with prices and categories", and the tool generates the full product list with consistent structure. You review every row in a preview, edit anything, and export the finished CSV.
This method shines when you would otherwise be typing hundreds of similar rows by hand, or when you are not sure what columns your target import format needs — the tool already knows the structure.
Which method should you use?
| Situation | Best method |
|---|---|
| Data already exists in a spreadsheet | Export from the spreadsheet (check formatting first) |
| A handful of rows, quick one-off | Text editor |
| Generated from another system, repeatable | Code with a CSV library |
| Data needs to be written from scratch | AI generation with review |
Checklist before you use the file
- Header row present, with names your target system expects.
- Same number of values in every row.
- Values containing commas or quotes are properly quoted.
- Saved as UTF-8.
- No formulas or formatting artifacts — plain values only.