Excel Templates
The Create Excel Document from Template action generates Microsoft Excel (.xlsx) files from an uploaded template. You put placeholders, conditionals, and loops in the template; at runtime, Decoder fills them with workflow variables to produce a finished spreadsheet.
Where to Use It
In an automation, add the Create Excel Document from Template action (under Documents & Media). Configure:
- Template file – Upload your .xlsx template (required)
- Output filename – Name for the generated file (supports variables, e.g.
#Step1.reportName#.xlsx) - Main variable (optional) – A workflow variable whose properties become the default context for placeholders (e.g.
#Trigger.payload#so that[name]in the template resolves to that object’sname) - Variable mappings (optional) – Map template placeholder names to workflow variables (overrides main variable for those keys)
Output: A file result (filename, size, download URL) you can pass to email, Drive, or other steps.
Template Syntax Overview
| Syntax | Purpose |
|---|---|
[variableName] | Replace with the value of a variable (or [object.property] for nested) |
[#if:condition] … [/if:condition] | Include block only when condition is true |
[^if:condition] … [/if:condition] | Include block only when condition is false |
[#loop:arrayName] … [/loop:arrayName] | Repeat block for each item (vertical rows) |
[>loop:arrayName] | Repeat across columns (horizontal) |
Tags can span multiple rows: the opening and closing tags may be on different rows; the whole block is then shown/hidden or repeated together.
Text Placeholders
Syntax: [variableName] or [object.property] for nested fields.
Placeholders are replaced by the resolved value. If the variable is missing or null, the cell gets an empty string.
Examples:
Invoice Number: [invoiceNumber]→Invoice Number: INV-2025-001[customer.name]→ value ofcustomer.name[items.0.description]→ first item’sdescription
Variable source: Workflow variables (e.g. from trigger or previous steps). If you set Main variable, that object’s properties are used as the default context (e.g. [name] = main object’s name). Variable mappings can override specific placeholder names.
Conditionals
Use conditionals to include or remove whole blocks of rows based on data.
Show when true: [#if:...] … [/if:...]
- Syntax:
[#if:conditionName]…[/if:conditionName] - Behavior: If the condition is true, the content between the tags is kept; otherwise all rows in that block are removed from the output.
- Start and end tags can be on different rows (multi-row block).
Condition evaluation:
- Boolean: Passes if value is
true - Object/array: Passes if the value exists (not null), even if empty
- String: Passes if not null and not empty
- Number: Passes if non-zero (zero = false)
- Null/missing: Fails (block removed)
Examples:
[#if:hasVAT] | VAT: 20% | [/if:hasVAT]hasVAT = true→ row kepthasVAT = false→ row deleted
[#if:policies.homePolicy] | Home Policy Details
| Policy #: [policies.homePolicy.policyNumber]
| [/if:policies.homePolicy]- If
policies.homePolicyexists, all rows in the block are kept and placeholders are filled. - If
policies.homePolicyis null, the entire block (all those rows) is deleted.
Show when false: [^if:...] … [/if:...]
- Syntax:
[^if:conditionName]…[/if:conditionName] - Behavior: Block is kept when the condition is false (or null/missing); when true, the block is removed.
Example:
[^if:policies.homePolicy] | No Home Policy | [/if:policies.homePolicy]- If
policies.homePolicyis null → row shown. - If it exists → row deleted.
Loops
Vertical loops (repeat rows): [#loop:...] … [/loop:...]
- Syntax:
[#loop:arrayName]…[/loop:arrayName] - Behavior: The block of rows between the tags is repeated once per item in the array. Inside the block, use property names of each item (e.g.
[description],[amount]). - Start and end tags can be on different rows (multi-row block).
Example (single row):
Template:
[#loop:items] | [description] | [amount] | [/loop:items]Data: items = [ {"description": "Web Design", "amount": "$1,000"}, {"description": "Hosting", "amount": "$50"} ]
Output:
| Web Design | $1,000 |
| Hosting | $50 |Example (multi-row block):
Template:
[#loop:invoices] | Invoice Header
| Invoice #: [invoiceNumber] | Date: [date]
| Total: [totalAmount]
| [/loop:invoices]Each invoice in the array produces the full set of rows (header + invoice #/date + total).
Horizontal loops (repeat columns): [>loop:...]
- Syntax:
[>loop:arrayName](no closing tag in the same sense; content repeats in the same row across columns) - Behavior: Repeats content horizontally — one column per item.
Example:
Template (one row): [>loop:months] | [monthName] |
Data: months = [ {"monthName": "January"}, {"monthName": "February"}, {"monthName": "March"} ]
Output: January | February | March (same row, multiple columns).
Nested loops
You can nest loops (e.g. loop over invoices, and inside each invoice loop over line items). Use the appropriate array path and property names for each level (e.g. [#loop:invoices] then [#loop:invoices.items] with [description], [quantity], [price] inside the inner block). Multi-row blocks are supported at each level.
Variables and the Main Variable
- Workflow variables – Any variable you can reference in the automation (e.g.
#Trigger.field#,#StepName.output#) is available to the template after the step runs. The action resolves them and passes the resulting data into the template. - Main variable – If you set Main variable (e.g. to a JSON object from a trigger or previous step), that object is the root context. Placeholders like
[name]or[amount]then refer to properties of that object. You can still use[otherStep.field]for other workflow data. - Variable mappings – Key-value pairs that map template placeholder names to workflow variable references. These override the main variable for those names and are useful when your template uses names that don’t match the workflow variable names.
Tips
- Empty arrays: A loop over an empty array produces no rows (the block is effectively skipped).
- Null vs empty:
[#if:items]passes ifitemsexists (even[]); it fails ifitemsis null. Use[^if:items]to show a “no data” block when the array is null or missing. - Formulas and formatting – The template keeps cell formatting. Avoid putting placeholders inside Excel formulas; use plain cells and reference those cells in formulas if needed.
- File size – Template file is typically limited (e.g. 50MB). Large loops (many rows) can make the output file large; keep an eye on performance.
See Also
- Variables – How to reference step outputs and trigger inputs
- Document Templates – AI-powered Word/Google Docs templates
- Documents & Media Actions – PDF, Word, and Excel actions