Skip to content
Gallery
Export to Word Pro User Guide
Share
Explore
Setup Guide

icon picker
GenerateDocFromJSON

This page takes you through how to use the GenerateDocFromJSON formula.

What is this formula?

The GenerateDocFromJSON formula accepts data in JSON format and uses it to populate word templates. Using JSON enables the use of loop tags which allows for dynamically generated sections, table rows, numbered items, etc. in the exported word doc.

How to use the formula?

This sections takes you past the basic setup of the welcome page and into the specifics of the GenerateWordDoc formula. This example uses the
@Letter Template - With Loops.docx
template shown below.

1. Add data to Coda

Each tag that you put in your template doc will need to be replaced by data from your Coda doc. It is recommended to set up a table where each row contains the data for one export and the data for each loop is in a separate table. Then, once your button is set up in the next step, you will be able to loop through each row and generate a word doc for each one.
Sample Data for JSON Template
4
House Members
1

2. Set up JSON (potentially using JSON helper formulas)

Create a new column with type text to store the JSON.
If you are creating JSON using the helper formulas, add the JSONify formula to the JSON column passing in the key-value pairs that should be used for the tags. Whenever a list needs to be passed as a value to the JSONify formula, use the ListToText helper formula to convert the list to a string before passing it into the JSONify formula. It is recommended to create additional helper columns for each loop to aid with constructing the JSON. For more info on setting up these formula, see .
Sample Data with JSON Column
4
House Members with JSON Column
1

3. Set up “Generate URL” button

Create a new column in your data table called URL with type Link
Create another new column with type Button and select the GenerateDocFromJSON action
Set the JSON string to the column that stores the JSON you would like converted to Word
Set the “Results Column” to your URL column
Sample Data for JSON Template with "Generate URL" Button
4

4. Set up “Open URL” button

Create a new column with type Button and select the Open hyperlink action
Set the “URL” parameter to your URL column
Sample Data for JSON Template with "Open URL" Button
4

5. Set up “Download Word Doc” button

Create a new column with type Button and select the Push Buttons action
Select “Generate URL” as the first button to push, then “Open URL” as the second
(Optional) Hide the “Generate URL”, “URL”, and “Open URL” columns
Sample Data for JSON with "Download URL" Button
4

6. Try your button!

Click the “Download Word Doc” button in one of your rows to download and view the exported Word doc

to see another example that uses the GenerateDocFromJSON formula.
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.