CSV (Giá trị phân tách bằng dấu phẩy)
CSV là định dạng đơn giản nhất cho dữ liệu dạng bảng — các hàng giá trị được phân tách bằng dấu phẩy (hoặc dấu chấm phẩy, tab). Mọi bảng tính, cơ sở dữ liệu và ngôn ngữ lập trình đều đọc được CSV.
Loại MIME
text/csv
Loại
Văn bản
Nén
Không mất dữ liệu
Ưu điểm
- + Universal support in Excel, Google Sheets, databases, and every language
- + Human-readable and easy to generate
- + Minimal overhead — just data, no formatting or metadata
- + Streamable — can be processed line by line for large files
Nhược điểm
- − No data type information — numbers, dates, and strings all look the same
- − Encoding and delimiter ambiguity (comma vs semicolon vs tab)
- − No support for hierarchical or nested data
Khi nào nên dùng .CSV
Sử dụng CSV cho xuất/nhập dữ liệu đơn giản, trao đổi dữ liệu bảng tính và cung cấp dữ liệu cho các công cụ phân tích. Tránh dùng cho dữ liệu phức tạp hoặc có cấu trúc lồng nhau.
Chi tiết kỹ thuật
Tệp CSV là văn bản thuần với mỗi hàng trên một dòng mới và giá trị phân tách bằng dấu phẩy. Các trường chứa dấu phẩy, dấu xuống dòng hoặc dấu ngoặc kép phải được bao trong dấu ngoặc kép (dấu ngoặc nội bộ được thoát bằng cách nhân đôi).
Lịch sử
Các định dạng dữ liệu phân tách bằng dấu phẩy xuất hiện trước máy tính cá nhân, xuất hiện trong IBM Fortran vào những năm 1960. RFC 4180 (2005) đã chuẩn hóa quy ước phổ biến nhất.
Chuyển đổi từ .CSV
Chuyển đổi sang .CSV
Định dạng liên quan
Thuật ngữ liên quan
Learn More
File Format Conversion: A Complete Guide
Converting files between formats is a daily task for professionals across every industry. This comprehensive guide covers document, image, audio, …
How to Generate Strong Random Passwords
Password generation requires cryptographic randomness and careful character selection. This guide covers the principles behind strong password generation, entropy calculation, …
JSON vs YAML vs TOML: Choosing a Configuration Format
Configuration files are the backbone of modern applications. JSON, YAML, and TOML each offer different trade-offs between readability, complexity, and …
Text Encoding Explained: UTF-8, ASCII, and Beyond
Text encoding determines how characters are stored as bytes. Understanding UTF-8, ASCII, and other encodings prevents garbled text, mojibake, and …
CSV vs JSON vs XML: Data Exchange Formats Compared
Data exchange formats serve different needs. CSV excels at tabular data, JSON dominates web APIs, and XML powers enterprise integrations. …
How to Format and Validate JSON Data
Malformed JSON causes silent failures in APIs and configuration files. Learn how to format, validate, and debug JSON documents to …