Validate a CSV Against a Schema

Check a CSV or Excel file against a data contract: required values, types, unique columns, allowed values, ranges, patterns and missing or extra columns. Free, in your browser.

Quick answer: Write a data contract from a file, then check new files against it.

Related: Data Contract Generator and Validator · ODCS Data Contract Generator · CSV Guides and Free CSV Tools

How to use the Validate a CSV Against a Schema

Write a data contract from a file, then check new files against it.

The Data Contract tool writes a data contract from a sample file and checks new files against it. A data contract is a short written promise about a dataset: which columns it has, their types, which values may be empty, which must be unique, which values are allowed and how many rows to expect. The tool profiles your CSV, Excel, JSON or Parquet file, suggests rules and lets you switch each one on or off. It saves the result as an Open Data Contract Standard (ODCS) YAML file, or as a dbt schema.yml with the same rules as dbt tests. In the Validate tab you drop a new file and a contract, and see which rules pass or fail, how many rows break each rule, and example rows. Everything runs in your browser.

  1. Load a sample file
  2. Tick the rules you want and download the contract
  3. Validate a new file against it

Tips

Example

Input: orders_new.csv + orders.contract.yaml

Output: 3 of 14 rules failed status: 1 row breaks it (row 4: Refunded)

Browse by topic

Who uses Data Utility

Frequently asked questions · Data format benchmark

Frequently asked questions

What does it check?

Missing and extra columns, empty values, data types, duplicate values, allowed values, minimum and maximum, text length, patterns, minimum row count and duplicate rows.

Do I need a contract file first?

Make one from a good sample file in the first tab, or upload an ODCS YAML file you already have.

How are bad rows shown?

Each rule shows pass or fail, how many rows break it, and up to five example values with their row numbers. You can download the results as an HTML report or a CSV.

What is a data contract?

A written agreement about what a dataset must look like, stored as a YAML file. For example: customer_id is a whole number and never empty, status is one of active, inactive or pending, and the file has at least one row.

Which contract format does it use?

The Open Data Contract Standard (ODCS) version 3, published at bitol.io. Other tools that read ODCS can use the file. You can also save the same rules as a dbt schema.yml.

Can I trust the rules it suggests?

Treat them as a first draft. They describe the one file you loaded, not every future file. Review them, and keep only the rules you would defend.

Related pages

Topic guides

Guides