# Fill in a Template File

#### Overview

This procedure fills in a template with provided values. Currently, only `.txt` and `.docx` file types are supported for use as template files. This procedure is helpful in automation workflows where documents need to be dynamically generated, such as invoices, contracts, letters, certificates, or reports.

#### Use Cases

<table><thead><tr><th width="214.0390625">Use Case</th><th>Description</th><th>Placeholder Examples</th></tr></thead><tbody><tr><td><strong>Customer Invoices</strong></td><td>Automatically create invoices from billing data</td><td><code>{date}</code>, <code>{customer_name}</code>, <code>{total_amount}</code></td></tr><tr><td><strong>Employment Contracts</strong></td><td>Generate contracts for new hires based on HR forms</td><td><code>{employee_name}</code>, <code>{start_date}</code>, <code>{role}</code></td></tr><tr><td><strong>Appointment Reminders</strong></td><td>Send personalized reminders to patients or clients</td><td><code>{patient_name}</code>, <code>{appointment_time}</code></td></tr><tr><td><strong>Event Certificates</strong></td><td>Create custom certificates for attendees</td><td><code>{participant_name}</code>, <code>{event_name}</code></td></tr><tr><td><strong>Purchase Confirmations</strong></td><td>Generate confirmation emails or documents for online purchases</td><td><code>{order_id}</code>, <code>{product_name}</code>, <code>{price}</code></td></tr><tr><td><strong>Service Agreements</strong></td><td>Populate service agreements with client and project info</td><td><code>{client_name}</code>, <code>{service_description}</code></td></tr></tbody></table>

#### Input Concepts

<table data-full-width="true"><thead><tr><th width="166.23046875">Concept</th><th width="277.4140625">Description</th><th width="107.84375">Type</th><th width="84.83984375">Default</th><th>Required</th></tr></thead><tbody><tr><td><code>template</code></td><td>The <code>.txt</code> or <code>.docx</code> file to be filled in.</td><td>File</td><td>N/A</td><td>Yes</td></tr><tr><td><code>placeholder values</code></td><td>The text that will fill in the placeholders in the template. These must be enclosed in quotes. For example:<br><code>the name is "Jane Doe"</code></td><td>Text / String</td><td>N/A</td><td>Yes</td></tr><tr><td><code>template marker</code></td><td>The characters used to mark the placeholders in the template. Must be exactly two characters.</td><td>Text</td><td>"{}"</td><td>No</td></tr></tbody></table>

#### Output Concepts

<table><thead><tr><th width="201.46875">Concept</th><th>Description</th></tr></thead><tbody><tr><td><code>file</code></td><td>The file with the specified placeholders replaced by the provided values.</td></tr></tbody></table>

#### Automation Example

Consider the following `.txt` file, containing placeholders enclosed in `< >` symbols:

```
Invoice

Date: <date>
Customer Name: <customer_name>
Item: <item_description>
Total Amount: <total_amount>

Thank you for your business!
```

{% tabs %}
{% tab title="Kognitos Automation" %}
{% code lineNumbers="true" %}

```
the template
fill in the template
  the template marker is "<>"
  the date is "4/23/2025"
  the customer_name is "Jane Doe"
  the item_description is "Web Design Services"
  the total_amount is "$2000"
```

{% endcode %}
{% endtab %}

{% tab title="Resulting File" %}

```
Invoice

Date: 4/23/2025
Customer Name: Jane Doe
Item: Web Design Services
Total Amount: $2000

Thank you for your business!
```

{% endtab %}
{% endtabs %}

**Note:** Line 1 will raise a question, prompting you to provide or upload `the template` file itself.
