# Templates

### Overview

This procedure fills placeholders in a Word document (.docx) template with data from an Excel (.xlsx) file. One output document is generated per row in the spreadsheet. Placeholders in the template are marked by a pair of characters (default is "{}") and must match the column headers in the Excel file.

### Syntax

Below is a line-by-line overview of the automation syntax. Expand each line to learn more.

<details>

<summary><kbd>the template is</kbd></summary>

**What does it do?** Specifies the path to the Word document template (.docx).

**Where does it go?** This phrase should be written on a new line.

**Is it required?** ✅ Yes — This phrase is **required** in the syntax.

**Does it require input data?** ✅ Yes — A **Text** value should be specified.

**Example:** `the template is "path/to/template.docx"`

</details>

<details>

<summary><kbd>the data file is</kbd></summary>

**What does it do?** Specifies the path to the Excel file containing the data (.xlsx).

**Where does it go?** This phrase should be written on a new line.

**Is it required?** ✅ Yes — This phrase is **required** in the syntax.

**Does it require input data?** ✅ Yes — A **Text** value should be specified.

**Example:** `the data file is "path/to/data.xlsx"`

</details>

<details>

<summary><kbd>the template marker is</kbd></summary>

**What does it do?** Defines the two-character marker used to identify placeholders in the template. For example, if the marker is "<>", then a placeholder would look like "". The default is "{}". The marker must be exactly **two** characters.

**Where does it go?** This phrase should be written on a new line.

**Is it required?** 🌟 No — This phrase is **optional** in the syntax.

**Does it require input data?** ✅ Yes — A **Text** value should be specified.

**Example:** `the template marker is "<>"`

</details>

<details>

<summary><kbd>create pdfs from the template where</kbd></summary>

**What does it do?** Starts the PDF generation using the provided template and Excel data.

**Where does it go?** This phrase should be written on a new line.

**Is it required?** ✅ Yes — This phrase is **required** in the syntax.

**Does it require input data?** ⛔ No — This phrase does *not* require input data.

</details>

<details>

<summary><kbd>the excel is the data file</kbd></summary>

**What does it do?** Specifies the Excel file to use for the data source.

**Where does it go?** This phrase should be indented beneath `create pdfs from the template where`.

**Is it required?** ✅ Yes — This phrase is **required** in the syntax.

**Does it require input data?** ⛔ No — This phrase does *not* require input data.

</details>

### Examples

#### 1. Create a PDF From the Template

```
the template is "path/to/template.docx"
the data file is "path/to/data.xlsx"
the template marker is "<>"
create pdfs from the template where
    the excel is the data file
```
