How do I set default values for empty fields?
When a spreadsheet cell is empty, a normal token leaves a blank space in your email. Add the Liquid `default` filter, `{{ ColumnName | default: 'Fallback' }}`, to insert fallback text instead. Use it for greetings, optional fields. and any column that isn't always filled.
Contents
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:
Hi {{ FirstName | default: 'there' }}.
- Rows with a first name produce
Hi Sarah, - Rows with an empty
FirstNamecell produceHi there,
The same pattern works for any optional column, a company name, an account manager, a discount code:
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 with the blank keyword, which matches both empty and space-only cells:
{% if FirstName != blank %}Hi {{FirstName}},{% else %}Hi there,{% endif %}
Default value or condition, which should I use?
- Use the
defaultfilter 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 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,
if/elselogic for whole blocks of text. - How dates are formatted in a mail merge, control how date columns appear.
Ready to try it yourself?
SecureMailMerge for Outlook
Runs inside Outlook — no external app needed. Free to install.
Free · No credit card required