> ## Documentation Index
> Fetch the complete documentation index at: https://docs.alumio.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Format to CSV

> Converts the context data to CSV with options for the delimiter, enclosure, separator and skipping headers.

export const FormField = ({property, label, required = false, diType, uiPatterns, children}) => {
  const patterns = Array.isArray(uiPatterns) ? uiPatterns : uiPatterns ? [uiPatterns] : [];
  return <div style={{
    margin: '1.5rem 0'
  }}>
      <div style={{
    display: 'flex',
    alignItems: 'baseline',
    flexWrap: 'wrap',
    gap: '0.5rem',
    marginBottom: '0.25rem'
  }}>
        <strong>{label}</strong>
        <span style={{
    fontSize: '0.7rem',
    fontWeight: 600,
    textTransform: 'uppercase',
    letterSpacing: '0.04em',
    color: required ? '#6241f5' : '#6b7280'
  }}>
          {required ? 'Required' : 'Optional'}
        </span>
      </div>

      <div>{children}</div>

      {diType || patterns.length > 0 ? <p style={{
    fontSize: '0.85rem',
    color: '#6b7280',
    marginBottom: 0
  }}>
          {diType ? <>
              See the <a href={`/references/${diType}`}>{diType}</a> reference.{' '}
            </> : null}
          {patterns.length > 0 ? <>
              Accepts a <a href={`/documentation/placeholders-and-patterns/patterns#${patterns[0]}`}>pattern</a>.
            </> : null}
        </p> : null}
    </div>;
};

Turns your data into CSV text, the comma-separated format that spreadsheets and many older systems read and write. Give it a list of rows, where each row is a set of named values, and it produces one line per row. The settings below let you match the exact CSV style the receiving system expects: which character separates the columns, which character wraps values, and whether the first line carries the column names.

This documentation describes: [Schema](/schemas/serializer/csv)

## Fields

<FormField property="delimiter" label="Delimiter">
  The single character that separates one column from the next. Defaults to a comma (`,`). A semicolon (`;`) is common in regions where the comma is used as a decimal separator.
</FormField>

<FormField property="enclosure" label="Enclosure">
  The single character used to wrap a value when it contains the delimiter, a line break, or the enclosure character itself. Defaults to a double quote (`"`).
</FormField>

<FormField property="escape" label="Escape">
  The single character used to escape the enclosure character inside a value. Defaults to a backslash (`\`).
</FormField>

<FormField property="headers" label="Add headers">
  When on, the first line of the output lists the column names taken from your data's keys. Turn it off to write only the data rows, with no header line. On by default.
</FormField>

## Sample data

| Field       | Value |
| ----------- | ----- |
| Delimiter   | `;`   |
| Enclosure   | `"`   |
| Add headers | On    |

Input:

```json theme={null}
[
    { "sku": "A1", "name": "Wool scarf", "price": "19.99" },
    { "sku": "B2", "name": "Leather belt", "price": "29.50" }
]
```

Output (a single text value; `\n` marks each line break):

```json theme={null}
"sku;name;price\nA1;\"Wool scarf\";19.99\nB2;\"Leather belt\";29.50\n"
```

Written out, the CSV reads:

```
sku;name;price
A1;"Wool scarf";19.99
B2;"Leather belt";29.50
```

```json Configuration theme={null}
{
  "prototype": "csv",
  "parameters": {
    "delimiter": ";",
    "enclosure": "\"",
    "headers": true
  }
}
```
