Tablora

Tablora · Library

Keep a comma inside one CSV cell

A comma inside a quoted CSV field, as in "Red, blue", belongs to the value. Check that the inspector reads it as one cell before you download.

Commas that belong to the value

Descriptions, addresses and company names often contain commas. In a comma-separated file such a value has to be wrapped in quotes so the comma is not read as a field boundary. Software that splits each line on every comma ignores those quotes and turns a two-column record into three cells, shifting every later value one column to the right.

The inspector follows the CSV quoting rule. A comma inside a quoted field stays in the cell, and the quotes themselves are treated as syntax, not as part of the value.

Reading Mira and Red, blue

The page example has the header name,note and the record Mira,"Red, blue", with comma as the Delimiter. Parsing gives 2 rows and 2 columns, and row 2, column 2 reads Red, blue, without the surrounding quotes and with the comma inside the value.

The header's second field, note, lines up with Red, blue, so the record has exactly the header's width and Rows with a different width shows 0.

Checking a quoted field

A space before the opening quote

Hand-edited CSV often has a space after the comma: Mira, "Red, blue". Under the CSV rule a quote only opens a field when it is the first character of that field, so a space before it makes the quote an unexpected character. The inspector rejects the text with Check the entered values and try again, rather than guessing. Remove the space between the comma and the opening quote in your copy and calculate again.

A quote that is never closed has the same effect for every following line, so if the error persists, look for a missing closing quote.

Commas in app exports

The Tablora app's CSV export quotes any cell that contains a comma, a quote or a line break, so a description like Red, blue stays in one cell when the file is opened elsewhere.

Original synthetic example

Input
name,note Mira,"Red, blue"
Delimiter
,
Expected records
2
Columns in the first record
2
Cell to inspect
Row 2, column 2: Red, blue

Tools

Sources