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