# How do I set default values for empty fields?

> If not all fields in your spreadsheet are filled you might want to specify a default value in your template instead of just showing an empty value.

A normal mail merge token looks like this `{{ColumnName}}`

or if it contains spaces:

`{{ ["Column Name"] }}`

This will insert the value found in the column called 'ColumnName' (or 'Column Name' respectively).

If the cell is empty it will result in an empty value being inserted, leaving a blank gap, a stray comma, or an awkward "Hi," in your email. To avoid that, give the token a fallback value with the `default` filter.

## The default filter

Add `| default: 'Your fallback'` inside the token. SecureMailMerge inserts the fallback whenever the cell is empty, and the real value whenever it isn't:

`{{ ColumnName | default: 'Default value' }}`

or if it contains spaces:

`{{ ["Column Name"] | default: 'Default value' }}`

## A real-world example

A common use is a greeting where not every row has a first name:

```liquid
Hi {{ FirstName | default: 'there' }}.
```

- Rows **with** a first name produce `Hi Sarah,`
- Rows **with an empty** `FirstName` cell produce `Hi there,`

The same pattern works for any optional column, a company name, an account manager, a discount code:

```liquid
Your account manager is {{ ["Account Manager"] | default: 'our support team' }}.
```

## Default values and whitespace-only cells

The `default` filter treats a cell as empty when it is truly blank. A cell that contains only spaces is **not** caught by `default`, it counts as a value, so the (invisible) spaces are inserted instead of your fallback.

If your data might contain space-only cells, clean them up in the spreadsheet first, or use a [condition](https://www.securemailmerge.com/help/conditions/) with the `blank` keyword, which matches both empty and space-only cells:

```liquid
{% if FirstName != blank %}Hi {{FirstName}},{% else %}Hi there,{% endif %}
```

## Default value or condition, which should I use?

- Use the **`default` filter** when you just need a single fallback word or phrase in place of a missing value. It's shorter and reads inline.
- Use a **[condition](https://www.securemailmerge.com/help/conditions/)** when you need to show or hide a whole block of content, branch between several options, or handle space-only cells reliably.

The two combine well, you can put a `{{ ... | default: ... }}` token inside an `{% if %}` block.

## Related

- [Using conditions to show or hide content](https://www.securemailmerge.com/help/conditions/), `if` / `else` logic for whole blocks of text.
- [How dates are formatted in a mail merge](https://www.securemailmerge.com/help/date-formatting-in-mail-merge/), control how date columns appear.
