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.
CSVContent
RequiredColumns
Delimiter
,
CaseSensitive
TrimColumnNames
IsValid
FoundColumns
MissingColumns
UnexpectedColumns
ErrorMessage
Provide the CSV file as Binary Data.
Example:
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.
Examples:
, ; |
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.
CSV:
id,first_name,last_name,email,age,city,salary,joined
Required columns:
salary,city
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:
salary,country
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.
CSV header:
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.
For example:
"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.