Skip to content
Log in

csv_escape - Liquid Filter Reference

On this page

Description

Escapes a value for a CSV cell (RFC 4180). A value that contains a comma, double quote, carriage return, or line feed is wrapped in double quotes, and any double quote inside it is doubled. Any other value is returned unchanged.

It escapes CSV structure only. It does not guard against spreadsheet formula injection.

In a CSV feed, interpolated values are already escaped this way, so csv_escape is optional there. A value you pass through it is marked as encoded and is not escaped a second time.

Property Value
Return Type string
Category text

Examples

```liquid

{{ “Fridgetastic 3000” | csv_escape }} ```

Output: Fridgetastic 3000

```liquid

{{ “Beans, rice and more” | csv_escape }} ```

Output: "Beans, rice and more"

```liquid

{{ ‘say “hi”’ | csv_escape }} ```

Output: "say ""hi"""

Was this article helpful?

Was this article helpful?