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

# Fill Template

> Fill a DOCX template with data from previous steps.

`transform.template`, Fill a DOCX template with data from previous steps.

Use `transform.template` when the workflow should produce a DOCX from extracted
or transformed data: engagement letters, summaries, approval packets, or
customer-facing reports.

The template must already exist in the workspace. Use the workflow builder to
select the template and inspect its placeholders, then map each placeholder to a
field in `data`. Do not pass a whole object as one template expression; define
each key explicitly so missing placeholders are easy to debug.

```yaml theme={null}
- name: draft-letter
  type: transform.template
  with:
    templateId: tmpl_...
    data:
      client_name: "{{ steps.extract.output.clientName }}"
      total_amount: "{{ steps.extract.output.total }}"
```

## Configuration

Configuration goes inside the step's `with:` block.

<ParamField path="templateId" type="string" required>
  ID of the template from templates table
</ParamField>

<ParamField path="data" type="record<string, unknown>" required>
  Data object to merge into template. Each key must be explicitly defined - cannot pass a whole object as single expression
</ParamField>

<ParamField path="outputFilename" type="string">
  Output filename - supports \{\{field}} syntax
</ParamField>

<ParamField path="highlightNotFound" type="boolean" default="true">
  Highlight missing variables with red-colored text in the output document
</ParamField>

<ParamField path="notFoundText" type="string" default="NOT FOUND">
  Text to display for missing variables when highlightNotFound is enabled
</ParamField>

## Output

<ResponseField path="fileId" type="string" required>
  File ID from files table
</ResponseField>
