At its core, a CSV file is a plain text file that stores tabular data (numbers and text) in a very simple, structured way. Think of it like a spreadsheet (like Excel or Google Sheets) that has been stripped of all its formatting—no bold text, no formulas, no cell colors, no multiple worksheets. Just the raw data and a simple set of rules to organize it into rows and columns.
You can open a CSV file in a spreadsheet program, but you can also open it in a basic text editor like Notepad or TextEdit. If you do, you won't see a grid; instead, you'll see lines of text separated by commas.
The primary purpose of a CSV file is data exchange. It acts as a universal bridge between different applications that don't normally speak the same language.
Because it's simple and text-based, almost any data-related program can read and write CSV files. Common uses include:
pandas library) or R for analysis, machine learning, or visualization.The entire format is based on just three simple rules: delimiters, rows, and quoting.
Imagine a simple table of data:
| Name | Age | City |
|---|---|---|
| Alice | 30 | New York |
| Bob | 25 | Los Angeles |
Here is exactly how that table is saved as a .csv file:
Name,Age,City
Alice,30,New York
Bob,25,Los Angeles