> For the complete documentation index, see [llms.txt](https://docs.feathery.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.feathery.io/platform/document-autofill-and-signatures/autofill-document-templates/word-doc-autofill/dynamic-tables.md).

# Dynamic Tables

### Table Configuration

1. **Add each field to the setup line** which determines the number of table rows:

   ```django
   {% set max_length = [<field_1>|length, <field_2>|length, <field_3>|length]|max %}
   ```

   \
   For each field you want in the table, add `<field>|length` in between the  `[` and `]`, and separate with commas
2. **Create the table structure** with dynamic content:

<table data-header-hidden><thead><tr><th></th><th width="249.265625"></th><th></th></tr></thead><tbody><tr><td>Header one</td><td>Header two</td><td>Header three</td></tr><tr><td>{%tr for i in range(max_length) %}</td><td></td><td></td></tr><tr><td>{{ &#x3C;field>[i] if i &#x3C; &#x3C;field>|length else "" }}</td><td>{{ &#x3C;field>[i] if i &#x3C; &#x3C;field>|length else "" }}</td><td>{{ &#x3C;field>[i] if i &#x3C; &#x3C;field>|length else "" }}</td></tr><tr><td>{%tr endfor %}</td><td></td><td></td></tr></tbody></table>

3. **Add header columns** to match your table structure. These can be plain text, or make use of a field value using `{{ <field> }}` .
4. **Add columns in between the table template rows (third row)** to match your desired table and fill with field values:

   ```django
   {{ <field>[i] if i < <field>|length else "" }}
   ```

{% hint style="info" %}
Make sure you replace every `<field>` with your own field names!
{% endhint %}

### Finished Table

<figure><img src="/files/rPAgmOqKrSRJf8s3ePEj" alt="" width="563"><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.feathery.io/platform/document-autofill-and-signatures/autofill-document-templates/word-doc-autofill/dynamic-tables.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
