CSV Column Validator is a reusable OutSystems component that validates CSV header structures and data rows before they are imported, processed, or passed to downstream workflows.
The component provides two actions:
ValidateCSVColumns — validates the CSV header against a list of required column names.
ValidateCSVData — validates CSV data rows using configurable required-field and regular-expression rules.
The component supports configurable delimiters, case-sensitive or case-insensitive column matching, optional whitespace trimming, UTF-8 CSV content, quoted values, and detailed validation error reporting.
It also includes a dedicated demo application to demonstrate header validation and row-level data validation scenarios.
Validate CSV headers against required columns.
Identify missing and unexpected columns.
Support custom single-character CSV delimiters.
Support case-sensitive and case-insensitive column-name comparison.
Optionally trim leading and trailing spaces.
Detect empty column names.
Support UTF-8 CSV content and UTF-8 BOM handling.
Parse quoted CSV values, escaped quotes, and multiline quoted records.
Validate required data fields.
Validate column values using regular-expression patterns.
Identify the row and column associated with validation errors.
Return total, valid, and invalid row counts.
Configure the maximum number of validation errors returned.
Indicate when the validation error limit has been reached.
OutSystems 11.
CSV file content provided as Binary Data.
A comma-separated list of required columns for header validation.
A list of validation rules for row-level data validation.
Validates the CSV header against a user-defined list of required columns. Returns the detected columns, missing required columns, unexpected columns, and error information.
CSVContent
RequiredColumns
Delimiter
,
CaseSensitive
TrimColumnNames
IsValid
FoundColumns
MissingColumns
UnexpectedColumns
ErrorMessage
CSV header:
id,first_name,last_name,email,age,city,salary,joined
Required columns:
salary,city
Expected result:
IsValid: True
FoundColumns: id,first_name,last_name,email,age,city,salary,joined
MissingColumns: Empty
UnexpectedColumns: id,first_name,last_name,email,age,joined
id,first_name,last_name,email,age,joined
ErrorMessage: Empty
Unexpected columns do not, by themselves, make IsValid false.
salary,country
IsValid: False
MissingColumns: country
country
UnexpectedColumns: id,first_name,last_name,email,age,city,joined
id,first_name,last_name,email,age,city,joined
Missing required columns are reported through the validation outputs rather than as technical errors.
Validates CSV data rows against a configurable list of validation rules. Each rule identifies a column, specifies whether the field is required, and optionally defines a regular-expression pattern for validating its value.
The action returns row counts and a list of detailed validation errors, allowing consuming applications to identify problematic records and display useful feedback.
ValidationRules
CaseSensitiveColumnNames
TrimValues
MaxErrors
Each item in ValidationRules contains:
ColumnName
IsRequired
RegexPattern
When IsRequired is True, an empty or whitespace-only value produces a validation error.
Example:
first_name
email
phone
In this example, first_name and email must have values, while phone may be empty.
A regular-expression pattern can be supplied to validate the format of a field.
Examples:
postal_code
^[0-9]{6}$
employee_code
^EMP[0-9]{4}$
EMP
date_text
^[0-9]{4}-[0-9]{2}-[0-9]{2}$
yyyy-MM-dd
These examples validate text patterns, not the semantic validity of the resulting value. For example, a matching date pattern does not guarantee that the date exists.
The implementation uses regular-expression matching. Use ^ and $ anchors when the entire value must match the supplied pattern.
^
$
An optional field with an empty value is allowed and its regex check is skipped. A required field that is empty generates a required-field error.
TotalRows
ValidRows
InvalidRows
ValidationErrors
ErrorsTruncated
True
False
Each item in ValidationErrors contains:
RowNumber
Value
ErrorType
The implementation uses the following error types:
Required — a required field is empty.
Required
Regex — a value does not match its configured regular-expression pattern.
Regex
ColumnNotFound — a configured validation column does not exist in the CSV header.
ColumnNotFound
InvalidCSV — the CSV contains a structural or parsing problem.
InvalidCSV
InvalidRule — a validation rule is invalid, such as a duplicate rule or invalid regular-expression pattern.
InvalidRule
CSV:
employee_code,email,phone EMP1001,alice@example.com,9876543210 EMP1002,,9123456780 EMP10A3,bob@example.com,9988776655
Example rules:
^[^@\s]+@[^@\s]+\.[^@\s]+$
Expected validation findings:
Row 2: Valid.
Row 3: Invalid because email is empty.
Row 4: Invalid because employee_code does not match the configured pattern.
Assuming no other errors, the counts are:
TotalRows: 3
ValidRows: 1
InvalidRows: 2
ValidationErrors contains the details of the required-field and regex errors.
The MaxErrors input controls the maximum number of validation errors that can be returned.
For example:
MaxErrors = 100 — limits the returned error list to 100 entries.
MaxErrors = 100
MaxErrors = 0 — uses the default limit of 1,000.
MaxErrors = 0
ErrorsTruncated = True — indicates that the error limit was reached.
ErrorsTruncated = True
When the error limit is reached, validation stops processing further errors and IsValid is set to False. Row counts may therefore reflect only the rows processed before the limit was reached.
Use ValidateCSVColumns when the primary requirement is to verify that all required column names are present.
ValidateCSVColumns
Typical flow:
Accept the uploaded CSV file.
Call ValidateCSVColumns.
Check IsValid.
If valid, proceed with the next processing step.
If invalid, display MissingColumns and other applicable information.
Use ValidateCSVData when the file must also satisfy field-level requirements.
ValidateCSVData
Accept the CSV file.
Configure the validation rules.
Call ValidateCSVData.
Review IsValid, TotalRows, ValidRows, and InvalidRows.
Display or process the entries in ValidationErrors.
Continue with the import only when appropriate for the business workflow.
The component decodes CSV content as UTF-8 and removes a UTF-8 BOM when present.
It supports configurable single-character delimiters, quoted values, escaped double quotes, and multiline quoted records.
Completely empty data lines are ignored when calculating the row counts.
ValidateCSVColumns expects RequiredColumns as a comma-separated list regardless of the CSV delimiter. For example, a semicolon-delimited file can use Name,Age,Email as its required-column definition.
Name,Age,Email
ValidateCSVColumns validates the CSV header structure; it does not validate individual data values.
ValidateCSVData validates configured fields using required-value and regular-expression rules.
The component does not automatically infer data types or validate business-specific rules beyond the configured requirements and patterns.
A regex matching a date or number format does not necessarily prove that the value is semantically valid.
Additional CSV columns that are not covered by validation rules are not subjected to field-level validation by ValidateCSVData.
CSV input is expected to be UTF-8 encoded.
When the maximum error limit is reached, the returned row counts may be partial.
A dedicated demo application, CSVColumnValidatorDemo, is included to demonstrate the component's functionality.
The demo allows users to select a CSV file, configure the delimiter and required columns, toggle case sensitivity and column-name trimming, and execute validation.
The interface displays the validation result, detected columns, missing columns, unexpected columns, and relevant error information.
The examples demonstrate both successful header validation and failure when a required column is missing.
Refer to the license specified in the Forge component metadata for the applicable licensing terms.
CSV Column Validator is an OutSystems utility component for validating the structure of a CSV file before it is processed, imported, or passed to downstream workflows.
The component reads the first row of the CSV as the header row and compares the detected column names against a user-defined list of required columns.
It returns the columns found in the CSV, identifies missing required columns, reports unexpected columns, and provides a validation result and error information.
Validates the column structure of a CSV file against a specified list of required columns.
Provide the CSV file as Binary Data.
CSV file ↓ Binary Data ↓ ValidateCSVColumns
The component returns an error when the supplied content is empty.
Provide the required column names as a comma-separated list.
id,first_name,email,salary
The required-column list is independent of the CSV delimiter.
For example, even when the CSV uses:
;
the required columns can still be supplied as:
Specifies the character used to separate columns in the CSV.
, ; |
If no delimiter is provided, the component uses:
The delimiter must contain exactly one character.
Controls how column names are compared.
Comparison is case-sensitive:
Email ≠ email
Comparison is case-insensitive:
Email = email
Controls whether leading and trailing spaces are removed from column names.
" salary "
is treated as:
"salary"
The original spacing is retained.
The component first reads the first CSV row as the header row.
It then:
IsValid is set to True when all required columns are present in the CSV header.
Unexpected columns do not make the validation invalid.
Result:
IsValid = True MissingColumns = "" UnexpectedColumns = id,first_name,last_name,email,age,joined
This allows applications to require specific columns while still accepting additional columns.
A required column that does not exist in the CSV header is returned through MissingColumns.
Required:
IsValid = False MissingColumns = country
This is considered a validation result, not a technical error, so ErrorMessage remains empty.
Columns found in the CSV but not listed as required are returned through UnexpectedColumns.
id,name,email,city
name,email
UnexpectedColumns = id,city
Unexpected columns are informational and do not cause IsValid to become false.
The component checks for duplicate column names in both:
Duplicate detection respects the CaseSensitive setting.
id,name,email,email
The component returns an error similar to:
CSV contains duplicate column names: email
Likewise, duplicate required columns such as:
name,email,name
are rejected.
The component rejects headers containing empty column names.
id,,email
CSV contains one or more empty column names.
The header parser supports quoted values.
"Customer, Name",Age,City
is interpreted as:
Customer, Name Age City
The comma inside "Customer, Name" is treated as part of the column name rather than as a delimiter.
"Customer, Name"
Escaped quotes are also handled.
"Customer ""Primary"" Name",Age
The component expects CSV content encoded as UTF-8.
A UTF-8 Byte Order Mark (BOM) is automatically removed when present so that it does not become part of the first column name.
The component uses ErrorMessage for technical or structural failures.
Examples include:
CSV content is empty.
Required columns were not provided.
Delimiter must contain exactly one character.
CSV header row is empty.
CSV contains duplicate column names: ...
Required columns contain duplicates: ...
CSV header contains an unclosed quoted value.
Missing required columns are not treated as technical errors. They are returned through:
IsValid MissingColumns
A typical application flow is:
Upload CSV ↓ ValidateCSVColumns ↓ IsValid? ┌───────┴────────┐ Yes No ↓ ↓ Process CSV Display missing / validation info
ValidateCSVColumns ↓ If(IsValid) ↓ Continue CSV processing
For an invalid file:
MissingColumns UnexpectedColumns ErrorMessage
can be displayed to the user or logged for troubleshooting.
Delimiter = , CaseSensitive = True TrimColumnNames = True
IsValid = True FoundColumns = id,first_name,last_name,email,age,city,salary,joined MissingColumns = UnexpectedColumns = id,first_name,last_name,email,age,joined ErrorMessage =
The application can use this result to inform the user that the uploaded CSV does not contain all required columns.
id,Name,Email
With:
CaseSensitive = False
the columns match successfully.
CaseSensitive = True
Name and name are treated as different column names.
Name
name
id;name;email;city
Use:
Delimiter = ;
The component correctly parses the header using ; as the delimiter.
A dedicated CSVColumnValidatorDemo application is included to demonstrate the component.
The demo allows users to:
The demo includes examples of both successful and unsuccessful validation scenarios.
The component validates the CSV header structure only.
It does not validate:
It also reads the first CSV line as the header row, so it is intended for CSV files whose header is contained in the first row.