CSV
CSV is a simple file format used to store and exchange structured data, where values are separated by commas. It is widely used for importing and exporting tabular data between databases, spreadsheets, and software applications due to its lightweight and human-readable format. Each line in a CSV file represents a row, with values separated by delimiters like commas, semicolons, or tabs.
Also known as: CSV file format, flat-file format.
Comparisons
- CSV vs. JSON: CSV is a flat, row-based format, while JSON supports hierarchical and nested data structures.
- CSV vs. Excel (XLSX): CSV is a plain-text format without styling or formulas, whereas Excel files contain additional features like formatting and embedded functions.
Pros
- Lightweight: Minimal file size makes it easy to store and transfer.
- Human-readable: Simple text format that can be opened with any text editor.
- Widely supported: Compatible with databases, spreadsheets, and programming languages.
Cons
- Limited structure: Does not support complex or nested data.
- No data validation: Cannot enforce data types or integrity rules.
- Encoding issues: Differences in character encoding (e.g., UTF-8 vs. ASCII) can cause inconsistencies.
Example
A company exports user data from a database into a CSV file for analysis in a spreadsheet application:
ID,Name,Email,Signup Date1,John Doe,john.doe@email.com,2023-05-102,Jane Smith,jane.smith@email.com,2023-06-153,Bob Johnson,bob.johnson@email.com,2023-07-20
This format allows easy sharing and importing of structured data across different platforms and tools.