What is CSV?

Learn what CSV files are, how comma-separated values work, and when to use them. Understand CSV format structure, limitations, and differences from Excel files.

The CSV format explained: how comma-separated values store tabular data, CSV vs Excel, and its quirks.

CSV

What is CSV?

CSV (Comma-Separated Values) is a plain text format that stores tabular data as rows of values separated by commas, making it the most universal format for exchanging spreadsheet and database data between applications.

How CSV Structures Data

CSV (Comma-Separated Values) is the simplest way to store tabular data, a table of rows and columns, in a plain text file. The rule is exactly what the name says: each line of the file is one record (a row), and the fields within a record (the columns) are separated by commas. An optional first line, the header, names the columns. That is essentially the entire format: rows on lines, columns split by commas. A spreadsheet of names and emails becomes a few lines of name,email text.

This radical simplicity is CSV's superpower. Because it is plain text with an obvious structure, virtually every program that handles data can read and write it: spreadsheets like Excel and Google Sheets, databases, programming languages, analytics tools, and countless web services. CSV is the universal lingua franca for moving data between systems that otherwise share no common format, which is exactly why it remains everywhere despite being decades old.

The format does have to handle a few edge cases. A field that itself contains a comma, a line break, or a quote would break the simple split-on-commas rule, so such fields are wrapped in double quotes, and quotes inside them are doubled. This quoting convention is the one piece of real complexity in CSV, and it is where most CSV bugs come from when a program parses naively by splitting on every comma.

CSV vs a Spreadsheet (XLSX)

It is important to understand what CSV is not. A CSV holds only the data, the raw values in rows and columns. It does not store formatting, fonts, colors, multiple sheets, formulas, charts, or cell types; it is just text. An XLSX (Excel) file, by contrast, is a rich spreadsheet that stores all of those things. So when you save an Excel workbook as CSV, you keep the values of a single sheet and lose everything else, formulas become their computed values, formatting and extra sheets disappear.

This is by design, not a flaw. CSV's job is to be a clean, portable carrier of pure data that any system can import, while XLSX's job is to be a full working spreadsheet. You use CSV to move data between tools and XLSX to work with data in a spreadsheet. Converting between them is routine: export to CSV to feed another system, import a CSV into Excel to analyze it.

When to Use CSV

Reach for CSV whenever you need to exchange tabular data between different programs: exporting records from a database or web app, importing a contact or product list, feeding data into an analytics or programming tool, or storing simple datasets in a future-proof, universally-readable form. It is the right choice any time the data matters and the formatting does not. When you need formatting, formulas, or multiple sheets, use XLSX instead.

Limitations and Quirks

CSV's simplicity brings real quirks. There is no single official standard, so files vary: some use semicolons instead of commas (common in regions where the comma is a decimal separator), line endings differ across systems, and character encoding (ideally UTF-8) must be agreed on or text can garble. It stores no data types, so everything is text, leading numbers can lose their leading zeros, long numbers can turn into scientific notation, and dates can be misread when a CSV is opened in Excel. And it holds only one table with no formatting or formulas. These are the price of being the simplest, most universal data format, and they are why careful import settings matter when working with CSV.

CSV vs Other Spreadsheet & Data Formats

FeatureCSVXLSXJSON
Structure/typeDelimited text[1]Zipped XMLNested text
Formatting/formulasNone[3]YesNone
Data shapeFlat tableMulti-sheetHierarchical
Standardized byIETF (RFC 4180)[2]ECMA / ISOECMA / IETF
App supportUniversalBroadBroad
Best forTabular interchangeRich spreadsheetsStructured data

CSV is a simple flat-table interchange format, while XLSX adds formatting and formulas and JSON handles nested data.

Advantages & Disadvantages

Advantages

Universal Compatibility, Every spreadsheet app, database, and programming language can read and write CSV without special libraries.

Human Readable, CSV is plain text - you can open and edit it in any text editor and immediately understand the data.

Tiny File Size, No formatting, no metadata - CSV files are extremely compact compared to XLSX or database exports.

Easy to Generate, Any application or script can produce valid CSV with a simple loop, making it ideal for data exports.

Disadvantages

No Data Types, Everything is stored as text - dates, numbers, and booleans must be interpreted by the receiving application.

No Formatting, CSV stores only raw data - no bold text, colors, merged cells, or any visual formatting.

Encoding Issues, Special characters and non-ASCII text often cause problems when files are opened in different locales.

No Relationships, CSV cannot represent relational data or multiple tables - you need multiple files or a different format.

Common Use Cases

Here are the most common scenarios where CSV is the right choice:

Database Exports

Exporting database tables to CSV for backup, analysis, or migration to another system.

Data Analysis

Input format for Python pandas, R, Excel, and virtually every data analysis tool.

CRM and Marketing Data

Contact lists, email subscriber exports, and sales data shared between marketing tools.

Application Integration

Moving data between applications that do not share a native integration or API.

References

  1. RFC 4180: Common Format for CSV Files - IETF
  2. CSV, Comma Separated Values (RFC 4180) - Library of Congress
  3. Comma-separated values - Wikipedia

How to open a CSV file

CSV files are commonly handled by a variety of software tools that cater to different user needs. Professional tools like Microsoft Excel and Google Sheets offer advanced features for data manipulation, while free and open-source options like LibreOffice Calc provide robust functionality without cost. Browser-based applications are accessible and convenient for quick edits, while built-in tools in operating systems can handle basic CSV viewing and editing tasks.

When choosing software for CSV files, factors such as feature fidelity, the distinction between editing and viewing capabilities, cost models, and platform compatibility are crucial. Users should consider their export needs, as some applications may offer better integration with other formats. In some cases, converting CSV to a more specialized format may be beneficial for specific tasks or applications.

Microsoft Excel 2021

Windows, macOSOne-time $149.99 / Subscription $69.99/yr

Microsoft Excel is a powerful spreadsheet application that excels in data analysis and visualization. It supports CSV files with high fidelity, allowing users to view, edit, and manipulate data seamlessly. Excel provides extensive features for data sorting, filtering, and formula application specific to CSV content.

Key features
  • Advanced data analysis tools
  • PivotTables for summarizing data
  • Conditional formatting options
  • Data validation and error checking
  • Integration with Power Query for data import
Strengths
  • Comprehensive data manipulation capabilities
  • Strong support for complex formulas
  • Widely used in professional environments
Limitations
  • Higher cost compared to alternatives
  • Can be overwhelming for basic tasks

Exports to: XLSX, PDF, HTML, TXT

Best for: Choose Excel for robust data analysis and professional-grade features when working with CSV files.

Visit Microsoft Excel →

LibreOffice Calc 7.4

Windows, macOS, LinuxFree (GPL)

LibreOffice Calc is a free and open-source spreadsheet application that provides a solid alternative to commercial software. It handles CSV files effectively, allowing users to view and edit data while maintaining a high level of fidelity. Calc supports various data manipulation features, making it suitable for both casual and advanced users.

Key features
  • Comprehensive formula support
  • Data sorting and filtering options
  • Chart creation for data visualization
  • Macros for automating tasks
  • Import/export to multiple file formats
Strengths
  • Completely free to use
  • Strong community support and updates
  • Compatible with Microsoft Excel formats
Limitations
  • User interface can feel outdated
  • Performance may lag with large datasets

Exports to: XLSX, PDF, HTML, ODS

Best for: Select LibreOffice Calc for a free, feature-rich alternative to Excel that handles CSV files well.

Visit LibreOffice Calc →

Google Sheets 2023

All (browser)Free / Paid (Google Workspace)

Google Sheets is a cloud-based spreadsheet application that allows for real-time collaboration and easy access from any device. It supports CSV files, enabling users to view and edit data online with a focus on simplicity and accessibility. Sheets provides essential data manipulation features suitable for everyday tasks.

Key features
  • Real-time collaboration with multiple users
  • Basic data analysis functions
  • Integration with Google Forms and other services
  • Version history for tracking changes
  • Charting tools for visual data representation
Strengths
  • Accessible from any device with internet
  • Excellent collaboration features
  • Automatic saving and version control
Limitations
  • Limited advanced features compared to Excel
  • Requires internet connection for full functionality

Exports to: XLSX, PDF, ODS, HTML

Best for: Opt for Google Sheets for collaborative work and easy access to CSV files from anywhere.

Visit Google Sheets →

Notepad++ 8.5

WindowsFree (GPL)

Notepad++ is a versatile text editor that supports various programming languages and file formats, including CSV. It allows users to view and edit CSV files in a plain text format, making it suitable for quick edits or data inspection. While it lacks advanced spreadsheet features, it provides a lightweight option for handling CSV data.

Key features
  • Syntax highlighting for CSV format
  • Multi-document interface for easy navigation
  • Search and replace functionality
  • Customizable user interface
  • Plugin support for extended features
Strengths
  • Extremely lightweight and fast
  • Ideal for quick edits and inspections
  • Highly customizable with plugins
Limitations
  • Limited data manipulation capabilities
  • Not suitable for large datasets

Exports to: TXT, HTML, XML

Best for: Choose Notepad++ for quick and lightweight editing of CSV files without complex features.

Visit Notepad++ →