CSV Schema Validator
Validate CSV or TSV imports against column types and required values, including ranges and uniqueness, with safe pattern checks and row-level findings.{{ summaryTitle }}
{{ summaryLine }}
Validation brief
{{ briefGuidance.title }}
{{ briefGuidance.message }}
- {{ step }}
| Severity | Row | Column | Check | Value | Action | Copy |
|---|---|---|---|---|---|---|
| {{ row.severityLabel }} | {{ row.row }} | {{ row.column }} | {{ row.check }} | {{ row.value }} | {{ row.action }} |
A delimited file can look tidy in a spreadsheet and still fail at import time. One row may contain an extra comma, an identifier may appear twice, a date may be impossible, or a required column may use a slightly different header. Schema validation turns those expectations into repeatable checks before the data reaches a database, reporting system, or bulk upload.
CSV does not carry one universal schema inside the file. The delimiter and quote rules determine where fields begin and end, while a separate schema describes what each column is allowed to contain. TSV uses the same broad idea with tabs as separators. In both formats, line breaks inside a quoted field belong to the value rather than starting a new record.
| Layer | Question | Typical failure |
|---|---|---|
| Parsing | Can the text be divided into records and fields? | An unclosed quote or text after a closing quote. |
| Shape | Does every record have the expected number of fields? | A row has one column more or less than the header. |
| Schema | Do named columns satisfy their declared rules? | A missing required column, wrong type, duplicate value, or value outside a range. |
| Destination safety | Could a value be treated as a spreadsheet formula? | A cell begins with =, +, -, or @. |
Passing a schema means the checked rows meet the rules you supplied. It does not prove that an email address exists, that an identifier refers to a real record, or that the file matches an unstated downstream requirement. The schema is useful only when its column names, types, ranges, and empty-value policy match the real import contract.
How to Use This Tool:
Set the file dialect before defining column rules, because an incorrect delimiter or quote mode changes every later check.
- Choose Delimiter. Auto detection compares comma, tab, semicolon, and pipe counts in the first complete record outside quoted text; select a fixed delimiter when the import specification requires one.
- Paste the source or load one local CSV, TSV, or text file. Choose whether the Header row supplies exact column names and whether fields use double quotes, single quotes, or no quote character.
- Add one rule for each column that needs checking. Match header case exactly, or use names such as
column_1when the data has no header. - Select a data type and enable only the constraints the import needs: required column, empty-cell policy, uniqueness, minimum or maximum, allowed values, and an optional bounded regular expression.
- Open Advanced before loading a known Windows-1252 file or when leading and trailing spaces should be removed before comparison. Leave whitespace trimming off when spaces are meaningful data.
- Select Validate data. If parsing stops, correct the reported quote, header, row-width, or limit error before reading row-level findings.
- Use the accepted and rejected row counts for the overall decision, then follow the row and column locations in the Finding ledger to correct the source or schema.
Interpreting Results:
An accepted row has no error finding under the declared rules. Warnings about formula-like values do not reject a row, but they matter when the file may be opened or imported by spreadsheet software. Review those cells in the destination context rather than treating a report with no warnings as proof of safe spreadsheet handling.
A missing required column rejects every parsed data row because none can satisfy that contract. A malformed row with the wrong field count is rejected before column rules run. Revalidate after changing either the source or the schema; results from an earlier rule set do not describe the edited import.
Technical Details:
Delimited-text validation proceeds in order. Parsing must settle the record boundaries and headers before a column rule can be applied reliably. A structural failure stops that path rather than guessing how shifted cells should map to columns.
Rule Core
- Remove an initial Unicode byte-order mark, choose or infer the delimiter, and parse fields with the selected quote character.
- Reject unclosed quoted fields, quotes inside unquoted fields, and non-delimiter text after a closing quote.
- Use the first record as headers or generate
column_1,column_2, and so on. Blank or duplicate headers are structural errors. - Reject rows whose field count differs from the header width.
- Check required columns, empty-cell policy, type, inclusive minimum and maximum, exact allowed values, regular-expression matches, and uniqueness.
- Add a warning when a non-empty value begins with a character that spreadsheet software may interpret as a formula.
- Sort findings by row, column, severity, and rule, then count a row as rejected when it has at least one error.
| Type | Accepted form | Minimum and maximum mean |
|---|---|---|
| String | Any non-empty text when empty values are disallowed. | Character count, inclusive. |
| Integer | Optional sign followed by digits. | Numeric value, inclusive. |
| Number | Finite decimal or scientific notation. | Numeric value, inclusive. |
| Boolean | true, false, yes, no, 1, or 0, ignoring case. | No range bounds. |
| Date | A real calendar date in YYYY-MM-DD form, including leap-year checks. | Lexical ISO date, inclusive. |
Text with non-space content before and after @ and a dot in the final part. | Character count, inclusive. |
Allowed values use exact, case-sensitive text. Uniqueness also compares the resulting text exactly, after optional whitespace trimming. Regular expressions are limited to 160 characters and reject lookarounds, backreferences, and nested quantified groups that could create unsafe matching behavior.
Privacy and Processing Limits:
Pasted text and loaded files stay in the current browser tab and are not added to the page address. Validation is bounded so a very large or highly repetitive source does not produce an incomplete report.
- Source limit: 1 MiB, 5,000 data rows, 100 columns, and 250,000 cells.
- Schema limit: 20 column rules.
- Report limit: 2,000 findings; crossing it stops the result instead of presenting a partial ledger.
- Auto detection examines only the first complete record. Pin the delimiter when that row is not representative.
- The email rule checks shape only, and formula warnings do not sanitize the original data.
References:
- Common Format and MIME Type for Comma-Separated Values Files, RFC Editor, October 2005.
- Metadata Vocabulary for Tabular Data, W3C, 17 December 2015.
- CSV Injection, OWASP Foundation.