CSV files
- Tier: Free, Premium, Ultimate
- Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated
A comma-separated values (CSV) file is a delimited text file that uses a comma to separate values. Each line of the file is a data record. Each record consists of one or more fields, separated by commas. The use of the comma as a field separator is the source of the name for this file format. A CSV file typically stores tabular data (numbers and text) in plain text, in which case each line has the same number of fields.
The CSV file format is not fully standardized. Other characters can be used as column delimiters. Fields may or may not be surrounded to escape special characters.
When added to a repository, files with a .csv
extension are rendered as a table when viewed in
GitLab:
CSV parsing considerations
GitLab uses the Papa Parse library to parse CSV files. This library follows RFC4180 and has strict formatting requirements that can cause parsing issues with certain CSV formats.
For example:
- Spacing around comma (
,
) separators and double quotes ("
) can cause parsing errors. - Fields containing both commas and double quotes can cause the parser to misidentify field boundaries.
The following format causes parsing errors:
"field1", "field2", "field3"
The following format parses successfully:
"field1","field2","field3"
If your CSV file doesn't display correctly in GitLab:
- If fields are enclosed in double quotes (
"
), ensure the double quotes and comma (,
) separators are immediately adjacent, with no spaces in between. - Enclose all fields that contain special characters in double quotes (
"
). - Test how the CSV file displays in GitLab after making changes.
These parsing requirements only affect the visual rendering of CSV files and do not impact the actual file content stored in your repository.