---
title: Microsoft Word Templates
slug: docx-templater
image: https://make-cxp-documentation.ams3.cdn.digitaloceanspaces.com/apps-center-icons/PREVIEW_DEFAULT.png
docTags: 
createdAt: 2025-02-03T13:28:13.883Z
---

|   | With the Microsoft Word Templates app in Make, you can merge data from various services with templates and create Microsoft Word documents. |
| - | ------------------------------------------------------------------------------------------------------------------------------------------- |

:::hint{type="info"}
You do not need to establish a connection to use the Microsoft Word Templates app.
:::

# Microsoft Word Templates modules

## Actions

:::ExpandableHeading
### Fill out a document

In this module, the content of the field **Value** has to be an array of collections, where:

- Each collection corresponds to one data entry and contains one item `entry`
- Item `entry` contains a collection with two items `key` and `value`
- Item `key` contains the tag's name
- item `value` contains the tag's value

Template text:

```text
> {{#contact}}
>     {{name}}, {{phone}}
> {{/contact}}
               
```

::Image[]{src="https://api.archbee.com/api/optimize/oAyFj2GHlBeBVWF5OAir2/IhWljght649XuhpFvazmw_uuid-e97da13f-6f13-9d4d-765a-0dca07ec1718.png" size="60" width="480" height="904" position="flex-start" alt="Module setup Fill out a document" showCaption="false"}

The created document:

```text
> Jan Toman, 1234
> Eduard Salo, 7899999
               
```

You can also run a loop to populate a table. The example below shows how to create such table in a template:

![Populate a table](https://api.archbee.com/api/optimize/oAyFj2GHlBeBVWF5OAir2/cgyaFseYjPlu3-4moqnaR_uuid-743e3c78-329c-828c-a6cc-b4087299ca60.png)
:::

## Aggregators

:::ExpandableHeading
### Fill a document with a batch of data

If your data entries come as separate bundles, you may prefer to employ the **Fill a document with a batch of data** aggregator module. You can also employ this module if your data entries come as an array - just employ the iterator module to transform the content of the array into a series of bundles.

The main advantage of the **Fill a document with a batch of data** module is that it enables you to easily setup the structure required for the **Value** field and map items to each `value` item. In contrast to the **Fill out a document** module, the field **Values** contains only a single entry, the actual entries will be created and populated for each incoming bundle. The template will be produced after all input bundles have been processed. The aggregator module is useful, especially when creating lists or reports.

**Example:** Export Google Contacts into a table

::Image[]{src="https://api.archbee.com/api/optimize/oAyFj2GHlBeBVWF5OAir2/h-ol-GH68SsaysERDlGUq_uuid-ada2c115-188d-af00-afc8-43467efbc0c4.png" size="80" width="1479" height="644" position="flex-start" alt="Fill a document with a batch of data scenario example" showCaption="false"}

The first module loads the template. The next module retrieves all contacts from the specified group in Google Contacts. The aggregator module then aggregates all values retrieved from Google Contacts and merges them into the template. Finally, the last module will save the filled template to a desired location.

Template:

::Image[]{src="https://api.archbee.com/api/optimize/oAyFj2GHlBeBVWF5OAir2/cgyaFseYjPlu3-4moqnaR_uuid-743e3c78-329c-828c-a6cc-b4087299ca60.png" size="80" width="698" height="67" position="flex-start" alt="Template" showCaption="false"}

::Image[]{src="https://api.archbee.com/api/optimize/oAyFj2GHlBeBVWF5OAir2/-o_EJtFhJWPhSAVbonKZp_uuid-25d71f42-88b0-c141-5f37-97be886910a1.png" size="60" width="528" height="904" position="flex-start" caption="9word.png" alt="9word.png" showCaption="true"}

Final document:

::Image[]{src="https://api.archbee.com/api/optimize/oAyFj2GHlBeBVWF5OAir2/wo6yxvzkCOeTzStOFSaX0_uuid-68b30bb8-4a78-8c47-c552-1f77991d3e99.png" size="80" width="698" height="93" position="flex-start" alt="Final document" showCaption="false"}
:::

# Template creation in Microsoft Word

A template is a regular Microsoft Word document (.docx file) with special tags in its text that determine where and how to merge/fill in data. There are three types of tags: **Simple value**, **Condition,** and **Loop or section**.

:::ExpandableHeading
## Simple value

A `Simple value` tag is simply replaced with a corresponding value. The tag's name corresponds to the `Key` field's value, which is placed inside double curly braces: e.g. `{{name}}`.

The Microsoft Word Templates app accepts only single-line plain text for replacement values. When adding line breaks, they will be viewed as spaces and won't affect the formatting of the text.

Template:

```text
> Hi {{name}}!
```

Module's setup:

::Image[]{src="https://api.archbee.com/api/optimize/oAyFj2GHlBeBVWF5OAir2/NTv_SR7uT1AwCZBzxf6W__uuid-269331d1-0cff-14a4-ed0c-4ee65abe3ec2.png" size="60" width="449" height="720" position="flex-start" alt="Module setup" showCaption="false"}

Created document:

```text
> Hi Petr!
```
:::

:::ExpandableHeading
## Condition

A `Condition` tag enables you to wrap certain parts of a text that should be rendered conditionally. To wrap the conditional text, place it between the opening and closing tags. The name of the opening tag is prepended with a hash sign `#`, the name of the closing tag is prepended with a slash `/`.

Template:

```text
> {{#hasPhone}}Phone: {{phone}} {{/hasPhone}}
> {{#hasEmail}}Email: {{email}} {{/hasEmail}}
```

Module setup:

::Image[]{src="https://api.archbee.com/api/optimize/oAyFj2GHlBeBVWF5OAir2/6WFJrNzkrx4bXNyAqW46o_uuid-abcf6202-59fa-a9c0-883c-f1bb06a8021f.png" size="50" width="564" height="899" position="flex-start" alt="Module setup" showCaption="false"}

Created document:

```text
 > Phone: 123456
```
:::

:::ExpandableHeading
## Loop or section

A `Loop or section` tag enables you to repeat parts of a text. Similarly to the `Condition` tag, to wrap the repeated text, place it between the opening and closing tags. The name of the opening tag is prepended with a hash sign `#`, the name of the closing tag is prepended with a slash `/`.

When using loops, you can choose to employ either the **Fill out a document** module or the **Fill a document with a batch of data** aggregator module.


:::

