Common Data File Formats: CSV, TSV, XLSX, XML, PDF, and JSON

Data professionals work with many file types, each designed for different purposes. Some formats are optimized for exchanging tabular data, others preserve spreadsheet functionality, represent hierarchical records, or maintain the visual appearance of documents.

Choosing an appropriate format can affect:

  • File size
  • Processing speed
  • Data-type preservation
  • Compatibility
  • Human readability
  • Schema enforcement
  • Support for nested data
  • Ease of analysis
  • Security
  • Long-term maintainability

This article examines six commonly encountered formats:

  1. CSV
  2. TSV and other delimited text formats
  3. XLSX
  4. XML
  5. PDF
  6. JSON

What Is a Data File Format?

A file format defines how information is encoded and arranged within a file.

The format tells compatible software how to interpret:

  • Record boundaries
  • Field boundaries
  • Data types
  • Structural relationships
  • Formatting instructions
  • Metadata
  • Embedded content

A filename extension such as .csv, .json, or .xlsx usually indicates the expected format, but the extension alone does not guarantee that the contents are valid.

Delimited Text Files

A delimited text file stores records as plain text. Each line usually represents a record, while a delimiter separates individual fields.

Common delimiters include:

  • Comma
  • Tab
  • Vertical bar or pipe
  • Semicolon
  • Colon
  • Space

CSV and TSV are the two most common delimited formats.

CSV: Comma-Separated Values

A CSV file uses commas to separate fields.

customer_id,name,state,total_spent
1001,Mina Park,Arizona,425.50
1002,Daniel Smith,Colorado,287.00
1003,Aisha Khan,Texas,615.25

Each line represents a record, and the values within that record are separated by commas.

The first row commonly contains column names, but a header row is a convention rather than a universal requirement.

Handling Commas Inside Values

A value can contain a comma if the field is enclosed in quotation marks.

customer_id,name,address
1001,Mina Park,"125 West Street, Phoenix"
1002,Daniel Smith,"84 Lake Road, Denver"

If a quoted value contains a quotation mark, it is commonly represented by doubling it:

customer_id,comment
1001,"The customer selected the ""premium"" plan."

Therefore, the presence of commas in text does not necessarily require switching from CSV to TSV. A standards-compliant CSV parser should interpret quoted fields correctly.

TSV: Tab-Separated Values

A TSV file uses tab characters as delimiters.

customer_id	name	state	total_spent
1001	Mina Park	Arizona	425.50
1002	Daniel Smith	Colorado	287.00

TSV can be convenient when the data contains many commas because tabs are less common in ordinary text.

However, tabs can still appear in data and must be handled correctly. TSV therefore does not eliminate the need for defined parsing and escaping rules.

Other Delimited Formats

Organizations sometimes use:

  • Pipe-separated values
  • Semicolon-separated values
  • Colon-separated values
  • Fixed-width text

Pipe delimiters can be useful when commas and tabs frequently appear in text:

1001|Mina Park|Arizona|425.50
1002|Daniel Smith|Colorado|287.00

A custom delimiter should be documented clearly so that other systems can parse the file consistently.

Advantages of Delimited Text Files

Delimited files are:

  • Simple
  • Human-readable
  • Easy to generate
  • Widely supported
  • Suitable for tabular data
  • Convenient for exchanging data between systems
  • Easy to process with many programming languages

They are often appropriate for straightforward imports, exports, and analytical datasets.

Limitations of Delimited Text Files

Delimited text files have important limitations:

  • Data types are usually not stored explicitly.
  • Relationships between tables are not represented.
  • Nested data is difficult to express.
  • Encoding may be ambiguous.
  • Date and number formats may vary.
  • Missing values may be represented inconsistently.
  • Parsing rules may differ between applications.
  • Large files may be inefficient for repeated analytical queries.

For example, the value 01/02/2026 could represent January 2 or February 1, depending on regional conventions.

Delimited Files Do Not Guarantee Data Types

A CSV column may appear to contain integers, dates, or decimal values, but the file normally stores them as text.

Software reading the file must infer or be told the correct data types.

This can cause problems such as:

  • Leading zeros being removed from postal codes
  • Large identifiers being displayed in scientific notation
  • Dates being interpreted incorrectly
  • Empty values being confused with zeros
  • Mixed values producing an incorrect inferred type

A separate schema or data dictionary can reduce these risks.

XLSX: Microsoft Excel Open XML Spreadsheet

XLSX is the standard workbook format used by modern versions of Microsoft Excel.

An XLSX workbook may contain multiple worksheets. Each worksheet is organized into rows and columns, whose intersections form cells.

Cells may contain:

  • Text
  • Numbers
  • Dates
  • Formulas
  • Error values
  • Boolean values
  • References to other cells

A workbook may also contain:

  • Charts
  • Pivot tables
  • Formatting
  • Named ranges
  • Data-validation rules
  • Conditional formatting
  • Multiple worksheets
  • Embedded images

How XLSX Is Stored

XLSX is based on the Office Open XML standard. Internally, an .xlsx file is a compressed package containing multiple XML documents and related resources.

This is different from a single XML data file. Spreadsheet software manages the package and presents it as one workbook.

Advantages of XLSX

XLSX provides:

  • Support for multiple worksheets
  • Preservation of formulas
  • Rich formatting
  • Charts and pivot tables
  • Data-validation features
  • Broad spreadsheet compatibility
  • A familiar interface for business users
  • Better support for cell types than ordinary CSV files

It is useful when users need to inspect, calculate, format, or interact with data manually.

Limitations of XLSX

XLSX also has limitations:

  • It is less convenient than text formats for automated processing.
  • Large workbooks may become slow.
  • Manual edits can reduce reproducibility.
  • Formulas can introduce hidden dependencies.
  • Formatting may be mistaken for actual data structure.
  • Merged cells and multiple header rows complicate extraction.
  • Different spreadsheet applications may interpret features differently.
  • Workbook structure may be difficult to validate automatically.

For reliable pipelines, data engineers should define which worksheets, ranges, and columns constitute the actual dataset.

XLSX and Macro Security

The standard .xlsx format cannot store VBA macros. Macro-enabled Excel workbooks normally use the .xlsm extension.

However, this does not make every XLSX file risk-free. Workbooks can still contain:

  • External links
  • Formulas
  • Embedded objects
  • Unexpected content
  • Sensitive information

Files from untrusted sources should still be handled carefully.

XML: Extensible Markup Language

XML is a text-based markup language for representing structured or semi-structured data.

It uses user-defined tags to describe information.

<?xml version="1.0" encoding="UTF-8"?>
<customers>
    <customer id="1001">
        <name>Mina Park</name>
        <state>Arizona</state>
        <totalSpent>425.50</totalSpent>
    </customer>
    <customer id="1002">
        <name>Daniel Smith</name>
        <state>Colorado</state>
        <totalSpent>287.00</totalSpent>
    </customer>
</customers>

The tags describe the meaning and hierarchy of the values.

XML and HTML

XML and HTML use similar markup syntax, but they serve different purposes.

HTML primarily describes how web content is organized and displayed. It uses a predefined set of familiar elements such as paragraphs, headings, and links.

XML is designed to represent and exchange information. Its tags are normally defined according to the application or data model.

XML Schemas

XML documents can be validated against formal schemas.

Common schema technologies include:

  • XML Schema Definition
  • Document Type Definition

A schema can specify:

  • Permitted elements
  • Required attributes
  • Data types
  • Element order
  • Repetition rules
  • Hierarchical relationships

This gives XML stronger validation capabilities than ordinary delimited files.

Advantages of XML

XML offers:

  • Human-readable text
  • Hierarchical data representation
  • Custom tags
  • Schema validation
  • Namespace support
  • Platform independence
  • Wide support across programming languages
  • Support for metadata and attributes

It remains common in enterprise systems, configuration files, document standards, and older web services.

Limitations of XML

XML can be:

  • Verbose
  • Larger than equivalent JSON
  • More complex to parse
  • Difficult to read when deeply nested
  • Computationally expensive for very large documents

XML parsers must also be configured securely because unsafe parsing features can create vulnerabilities.

JSON: JavaScript Object Notation

JSON is a text-based format for representing structured and semi-structured data.

Although it originated from JavaScript syntax, JSON is language-independent and supported by virtually every modern programming language.

A JSON document may contain:

  • Objects
  • Arrays
  • Strings
  • Numbers
  • Boolean values
  • Null values
{
  "customer_id": 1001,
  "name": "Mina Park",
  "state": "Arizona",
  "orders": [
    {
      "order_id": 501,
      "amount": 125.50
    },
    {
      "order_id": 532,
      "amount": 300.00
    }
  ],
  "active": true
}

JSON naturally represents nested objects and lists.

JSON in APIs

JSON is widely used by APIs and web services because it is:

  • Relatively compact
  • Easy for applications to generate
  • Easy for applications to parse
  • Compatible with web technologies
  • Suitable for hierarchical records

An API may accept JSON in a request and return JSON in its response.

Advantages of JSON

JSON offers:

  • Human-readable syntax
  • Broad language support
  • Support for nesting
  • Flexible schemas
  • Compact representation compared with many XML documents
  • Strong compatibility with APIs and web applications

Limitations of JSON

JSON has several limitations:

  • Comments are not part of the standard format.
  • Date and time types are not built in.
  • Binary data is not represented directly.
  • Large nested files can be inefficient to process.
  • Flexible schemas can lead to inconsistent records.
  • Standard JSON does not provide a native mechanism for references between documents.

Dates are typically represented as strings, so producers and consumers must agree on a format such as ISO 8601.

JSON and Binary Data

JSON does not directly store audio, video, or other arbitrary binary content efficiently.

Binary content can be encoded as text—often with Base64—and placed inside JSON. However, doing so increases file size and processing overhead.

A more common design is to store the media in file or object storage and include its URL, identifier, and metadata in the JSON document:

{
  "media_id": "A1045",
  "media_type": "audio",
  "location": "https://example.com/media/A1045",
  "duration_seconds": 92
}

JSON is therefore well suited to describing media but not necessarily to containing large media files.

PDF: Portable Document Format

PDF was developed to preserve the appearance and layout of documents across applications, operating systems, and devices.

PDFs are commonly used for:

  • Contracts
  • Financial statements
  • Research papers
  • Invoices
  • Government forms
  • Manuals
  • Reports
  • Archived documents

A PDF can contain:

  • Text
  • Images
  • Vector graphics
  • Fonts
  • Form fields
  • Annotations
  • Digital signatures
  • Embedded attachments

Advantages of PDF

PDF offers:

  • Consistent visual presentation
  • Broad device support
  • Print-ready layouts
  • Support for forms
  • Support for digital signatures
  • Convenient document sharing
  • Preservation of fonts and page design

It is appropriate when the appearance of a document is important.

Limitations of PDF for Data Analysis

PDF is primarily a presentation format, not an analytical data format.

Extracting data from PDFs can be difficult because:

  • Tables may not be stored as logical tables.
  • Reading order may be ambiguous.
  • Scanned PDFs may contain images rather than text.
  • Columns may be extracted in the wrong sequence.
  • Fonts may use unusual encodings.
  • Repeated headers may appear within extracted data.
  • Visual spacing may carry meaning that is absent from the internal representation.

A table that looks perfectly organized to a human may be stored as separately positioned text fragments.

Text-Based and Scanned PDFs

A text-based PDF contains machine-readable text. Its contents can often be extracted directly, although layout problems may remain.

A scanned PDF contains page images. Extracting its text generally requires optical character recognition.

OCR results should be validated because characters, numbers, and table layouts may be interpreted incorrectly.

Comparing the Formats

FormatPrimary structureBest suited forMajor strengthMajor limitation
CSVFlat tabular textSimple data exchangeBroad compatibilityWeak type and schema support
TSVFlat tabular textText containing many commasSimple delimiter choiceStill requires escaping and documented rules
XLSXSpreadsheet workbookInteractive business analysisFormulas, sheets, and formattingLess suitable for automated large-scale processing
XMLHierarchical markupEnterprise exchange and schema-controlled documentsStrong hierarchy and validationVerbose
JSONObjects and arraysAPIs and application dataCompact, flexible nestingLimited native data types
PDFPage-oriented documentConsistent presentation and printingPreserves visual layoutDifficult data extraction

Choosing the Right Format

No format is best for every situation.

Choose CSV or TSV when:

  • The data is tabular.
  • Maximum compatibility is important.
  • Files will be exchanged between many tools.
  • Formatting and formulas are unnecessary.
  • The dataset is relatively straightforward.

Choose XLSX when:

  • Business users need to work interactively.
  • Multiple worksheets are required.
  • Formulas, charts, or formatting must be preserved.
  • The file is intended for manual review.

Choose XML when:

  • Hierarchical data is required.
  • Formal schema validation is important.
  • An existing enterprise system requires XML.
  • Namespaces or document-oriented standards are needed.

Choose JSON when:

  • Data is exchanged through an API.
  • Records contain nested objects or arrays.
  • Web and application compatibility is important.
  • A flexible schema is acceptable.

Choose PDF when:

  • Visual presentation must remain consistent.
  • The document is intended for reading, printing, signing, or archiving.
  • Page layout is more important than direct analysis.

PDF should generally not be the first choice when the primary purpose is transferring data for analysis.

Performance Considerations

For small datasets, format selection may have little noticeable effect. At larger scales, the decision becomes more important.

Delimited text, JSON, and XML often require a system to scan and parse the file from the beginning. They may also occupy more storage than compressed binary or columnar formats.

Large analytical workloads frequently use formats such as:

  • Apache Parquet
  • Apache ORC
  • Apache Avro

These formats provide features such as:

  • Compression
  • Explicit schemas
  • Efficient data types
  • Column-oriented storage
  • Faster selective reads
  • Compatibility with distributed processing

CSV, JSON, XML, XLSX, and PDF remain important, but they are not always the most efficient formats for large-scale data platforms.

Encoding and Interoperability

Text formats depend on character encoding.

UTF-8 is widely recommended because it supports a broad range of characters and is compatible with many systems.

Without an agreed encoding, a file may display:

  • Corrupted punctuation
  • Incorrect accented characters
  • Missing symbols
  • Unreadable non-Latin text

A reliable data exchange should document:

  • File format
  • Character encoding
  • Delimiter
  • Header presence
  • Quote and escape rules
  • Date format
  • Decimal separator
  • Missing-value representation
  • Schema or field definitions

Security Considerations

Every file format can introduce security and privacy risks.

Important precautions include:

  • Scan files from untrusted sources.
  • Validate content before processing.
  • Restrict access to sensitive files.
  • Avoid executing embedded or referenced content.
  • Configure XML parsers securely.
  • Treat spreadsheet formulas and external links carefully.
  • Validate file size and structure.
  • Remove hidden metadata when appropriate.
  • Encrypt sensitive data during storage and transfer.

File extensions should not be trusted by themselves. A file’s actual content should be validated before it enters a production pipeline.

Practical Example

Suppose an organization must distribute monthly sales information.

CSV

Use CSV to exchange a flat table with another analytical system.

XLSX

Use XLSX when managers need multiple worksheets, formulas, conditional formatting, and charts.

JSON

Use JSON when a web application needs to retrieve sales records through an API.

XML

Use XML when integrating with a system whose formal interface requires an XML schema.

PDF

Use PDF when distributing a finalized report whose page layout must remain consistent.

The same underlying information may be published in several formats because different consumers have different requirements.

Key Takeaways

  • File formats determine how data is encoded, stored, exchanged, and interpreted.
  • CSV and TSV are widely supported formats for flat tabular data.
  • CSV fields containing commas can be enclosed in quotation marks.
  • Delimited files usually do not preserve data types or schemas.
  • XLSX supports multiple worksheets, formulas, charts, and formatting.
  • XML represents hierarchical information through user-defined tags and can support formal schemas.
  • JSON represents data through objects and arrays and is widely used by APIs.
  • JSON does not efficiently store large binary media directly.
  • PDF preserves document appearance but is difficult to use as a source for structured analysis.
  • Format selection should reflect data structure, performance, compatibility, security, and consumer requirements.

Conclusion

Understanding common file formats allows data professionals to select the representation that best matches the task.

CSV and TSV are useful for simple tabular exchange, XLSX supports interactive spreadsheet work, XML and JSON represent hierarchical data, and PDF preserves finished documents. Each format offers valuable capabilities, but each also introduces limitations.

The correct decision depends on how the data will be created, processed, exchanged, analyzed, and maintained.

One-sentence summary: CSV and TSV support simple tabular exchange, XLSX preserves spreadsheet features, XML and JSON represent hierarchical data, and PDF prioritizes consistent document presentation over analytical accessibility.

Similar Posts

Questions, corrections, or additional insights?