What is a CSV file?
A CSV file stores a table as plain text, with values separated by commas. Almost any tool can read and write it, so it's a common way to export and move data.
After reading this article you will be able to:
- Explain what a CSV file looks like
- Understand why text gets garbled and why leading zeros and dates change, and how to prevent it
- Know how CSV differs from an Excel workbook, and how to handle CSV files safely
On this page
- What does a CSV file look like?
- What if a value contains a comma or a line break?
- Why does text come out garbled?
- Why do leading zeros and dates change?
- How is CSV different from an Excel file?
- How do you handle CSV files safely?
- What is CSV injection?
- Files with personal information
- Summary
- Can I export form answers from mukumo as CSV?
- FAQs
A CSV file stores a table as plain text, with the values in each row separated by commas. CSV stands for comma-separated values. Each line is one row of the table, and each comma-separated piece is one cell.
Because it’s just text, almost any tool can read and write CSV: spreadsheets, databases and web services alike. It’s a common way to export the answers to a class sign-up form into a list, or to move an online course’s student roster into another tool. The format is so simple that, depending on how you open it, text can come out garbled or numbers can change. Knowing how it works helps you avoid that.
- Answers arriveA class sign-up form
- Export as CSVOne answer per line, commas between
- Open with importChoose the encoding and column types
- Use the tableBuild a list or count results
What does a CSV file look like?
Here’s what a few class sign-ups might look like as CSV:
- Line 1:
Name,Email,Course - Line 2:
Hana Yamada,hana@example.com,Intro to Watercolor - Line 3:
Ken Sato,ken@example.com,Oil Painting Basics
Open it in a spreadsheet and you see this:
| Name | Course | |
|---|---|---|
| Hana Yamada | hana@example.com | Intro to Watercolor |
| Ken Sato | ken@example.com | Oil Painting Basics |
Each line is one record, and each position between commas is a column. The first line is often a header row that names the columns. Every line should have the same number of columns.
The common format is written down in RFC 4180, published in 2005. It describes what most tools already did rather than setting a strict standard, so tools still differ in the details.
What if a value contains a comma or a line break?
If a value itself contains a comma, a program can’t tell where to split it. So any value that contains a comma, a line break or a double quote (“) is wrapped in double quotes:
- A value with a comma:
"Monday, Wednesday"is read as one value. - A value with a double quote:
"""First-timers"" welcome", where each “ inside is written twice. - A value with a line break: wrapped in double quotes, a multi-line answer still counts as one value.
If you write a program that simply splits each line at every comma, the columns will shift. To read CSV, use a spreadsheet’s import feature or the CSV library that comes with most programming languages.
In countries that use a comma as the decimal mark, CSV files often use semicolons (;) as the separator instead. A file separated by tabs is called TSV.
Why does text come out garbled?
A CSV file doesn’t record which character encoding (the rule for turning characters into numbers) it was written in. The program opening it has to guess, and when it guesses wrong, names with accents, Japanese text or emoji come out garbled.
| Encoding | What to know |
|---|---|
| UTF-8 | Covers the world’s writing systems. Widely used on the web and in modern services |
| Regional encodings | Older systems may use a regional encoding, such as Windows-1252 for Western European languages or Shift_JIS for Japanese |
A UTF-8 file sometimes starts with an invisible marker called a BOM (byte order mark). According to Microsoft, Excel opens a UTF-8 CSV file correctly if it was saved with a BOM. If there’s no BOM, don’t double-click the file. Use the text and CSV import on the Data tab instead, and choose the file’s original encoding there (Microsoft’s guide).
A BOM can cause trouble elsewhere, though. A program that doesn’t expect it may read it as part of the first column’s name. When you hand a CSV file to another tool, check first which encoding it expects and whether it wants a BOM.
Why do leading zeros and dates change?
A CSV cell carries no information about whether it’s a number, a date or text. When a spreadsheet opens the file, it guesses from what each value looks like and converts it. That leads to things like:
- A ZIP code such as
02134turning into2134 - A phone number written with a leading zero losing that zero
- A membership number with 16 or more digits showing in scientific notation (like 1.23E+15), with every digit after the 15th turned into 0
- Values like
12/2orMAR1turning into dates
Excel stores numbers with at most 15 digits of precision, so once a long ID is read as a number, the lost digits can’t be recovered. Read values like these as text instead:
- Open the file with the import feature and set columns such as phone numbers, ZIP codes and IDs to Text before loading.
- In newer versions of Excel, such as Excel for Microsoft 365, you can turn off conversions like removing leading zeros or creating dates under Automatic Data Conversion in the options.
- If you open the file and save over it, the converted values are what end up in the CSV, so keep a copy of the original.
Dates written like 03/04/2026 can mean March 4 or April 3, depending on the country. When you exchange data, write dates as year, month, day, such as 2026-10-12, the format set by the international standard ISO 8601, to avoid mix-ups.
How is CSV different from an Excel file?
An Excel workbook (.xlsx) can hold values together with formulas, formatting, charts and several sheets. A CSV file holds the values of one table, written out as text.
| CSV (.csv) | Excel workbook (.xlsx) | |
|---|---|---|
| Contents | Values as plain text | Values, formulas, formatting, charts and more |
| Sheets | One table | Several sheets |
| Data types | None (the program opening it guesses) | Keeps numbers, dates and text apart |
| Opens in | Almost any tool, including text editors | Spreadsheet apps |
To move data from one tool to another, CSV is the better fit because almost everything can read it. For a table people format by hand, or totals built with formulas, a spreadsheet file is the better fit. When you save as CSV from Excel, only the sheet you have open is saved. Formulas become their calculated values, and formatting is dropped.
How do you handle CSV files safely?
What is CSV injection?
Spreadsheets treat a cell that starts with = as a formula. OWASP, a community that publishes web security guidance, notes that values starting with +, -, @ or a tab can be treated as formulas too. CSV injection, also called formula injection, is when someone types formula-like text into a place anyone can fill in, such as a form, hoping it will run in the spreadsheet of whoever opens the exported file. The formula might try to send data to an outside site or show a misleading link.
Spreadsheets may warn you before doing something like loading outside data. A few calm habits go a long way:
- If a warning appears when you open a CSV exported from a public form, don’t select Enable unless you understand why it’s needed.
- Don’t click links or formulas in cells you don’t recognize. Check what’s in them first.
- If you’re the one creating CSV files, stop values from running as formulas, for example by adding
'in front of text values that start with one of those characters (OWASP’s guidance).
Files with personal information
A CSV file of sign-ups with names and email addresses is plain text with no lock of its own. Rather than emailing it around, keep it somewhere only the people who need it can open. Limiting access to only those who need it is the idea behind the principle of least privilege. When you’re done with a file, delete it rather than leaving it in your Downloads folder.
Summary
- A CSV file is a plain-text table: one record per line, with commas marking the columns.
- Values that contain commas, line breaks or double quotes are wrapped in double quotes.
- Garbled text comes from reading the wrong encoding. Check for a BOM and choose the encoding when you import.
- Read phone numbers, ZIP codes and long IDs as text so leading zeros and digits aren’t lost.
- Open CSV files exported from public forms with care for formulas and links.
Can I export form answers from mukumo as CSV?
In Forms, Export CSV saves all the answers you've received in a format you can open in a spreadsheet, so you can build a sign-up list or tally a survey.
To send each answer to another tool as it arrives, enter an https destination URL under Webhook in the form's settings, and mukumo sends the answer as JSON. You can also download your credit usage history as a CSV from Usage & history in Settings.
Available nowForms
FAQs
Which apps can open a CSV file?
Because a CSV file is plain text, spreadsheets such as Excel, Google Sheets and Numbers can open it, and so can a text editor like Notepad. Opening it in a text editor is a good way to see exactly how the commas and quotes are laid out.
What's the difference between CSV and TSV?
The separator. CSV separates values with commas, and TSV (tab-separated values) uses tabs. If your values contain lots of commas, TSV can save you from quoting them.
Can I edit an exported CSV in Excel and save it as CSV again?
You can, but if leading zeros or dates changed when you opened it, the changed values are what get saved. Only one sheet is kept, and formatting and formulas are lost. Keep a copy of the original file.
Can I password-protect a CSV file?
No. CSV is a plain-text format with no built-in way to add a password. Keep files with personal information somewhere only the right people can open, and delete them when you're done.