Tablora

Tablora · Library

Read a quote character inside a CSV field

In CSV, two double quotes inside a quoted field stand for one quote mark. See how the inspector reads She said "hello" and why backslashes fail.

How CSV writes a quote inside a value

A CSV field that contains a quote mark must itself be wrapped in quotes, and each quote inside it is written twice. So the cell text She said "hello" is stored in the file as "She said ""hello""". The outer quotes are syntax; each doubled pair inside stands for one literal quote character.

Some programs write a backslash before the quote instead, a convention borrowed from programming languages. The inspector follows the CSV rule, not that one, so a backslash-escaped quote is not accepted as an escape.

Checking the Poster row

The page example has a header item,note and one record whose note is "She said ""hello""", with comma as the Delimiter. The inspector reports 2 rows and 2 columns. Row 2, column 2 reads She said "hello", with exactly one quote mark before hello and one after it.

If you see two quote marks on either side of hello in the preview, the field was not quoted in the source and the text is probably not valid CSV at all.

Inputs that do not parse

Repairing and exporting quoted text

Quote marks in app exports

The Tablora app's CSV export follows the same rule when a cell contains a quote, a comma or a line break: the cell is wrapped in quotes and inner quotes are doubled. In its XLSX export the quote is simply part of the cell text, so no escaping is visible to you.

Original synthetic example

Input
item,note Poster,"She said ""hello"""
Delimiter
,
Expected records
2
Columns in the first record
2
Cell to inspect
Row 2, column 2: She said "hello"

Tools

Sources