# Creating templated documents

A common use case for AI agents is to create nicely formatted Documents, Slides, and Spreadsheets. This is useful for template contracts, proposals, presentations, posters, and much more.

The general construct for all of these is called "Copy and Fill in {{Placeholders}}", and this article will show you how to do it.

#### Copy doc and replace placeholders

If you want to create a template of a Google Doc or a PDF, this is the way to do it.

First, you need to create your template Google Doc. In that Google Doc, you can use any styling and formatting you want. The most important thing you need to do in that document is to set up the "placeholders" that will be dynamically replaced in your workflow. Each placeholder will be added with {{ }} curly braces around it. Here's a screenshot of a very simple template document.

<figure><img src="/files/CiezJcZNPrdO9ha932sD" alt=""><figcaption><p>Simple template document with 3 placeholders: Title, Author, and Date</p></figcaption></figure>

Now, you can use the "Copy doc and fill in {{placeholders}}" automation.

<figure><img src="/files/TQmj9WgYyu5sJV9ZkXeG" alt=""><figcaption><p>Navigating to Copy doc and fill in {{placeholders}} in the step menu</p></figcaption></figure>

When you create the step, you'll see an option to fill in the value for each placeholder dynamically based on an existing value in your workflow.

<figure><img src="/files/WFsscSEcfTrTYp1wr6V2" alt="" width="375"><figcaption><p>Filling in the placeholders based on the values from the trigger.</p></figcaption></figure>

Finally, when you run the workflow, you'll get a new document with the placeholders replaced:

<figure><img src="/files/ePhzFdCE1GLToSnNJpsr" alt=""><figcaption><p>Starting a sample manual trigger to fill in placeholders.</p></figcaption></figure>

<figure><img src="/files/9A5FOplpV8k2iPAMqZRn" alt=""><figcaption><p>The newly created document with placeholders replaced</p></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.relay.app/actions-in-apps/creating-templated-documents.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
