This page takes you through how to use the GenerateWordDoc formula.
What is this formula?
The GenerateWordDoc Formula allows you to take data straight from Coda Tables and into word templates. This is really powerful because it allows ease of data entry in Coda to translate into formatted documents in word. Using placeholders tags, this formula allows data from Coda to automatically go into the right place on your document. Additionally, this formula support conditionals to allow you to choose if certain text elements should be displayed or not for each export.
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 - No Loops.docx
template shown below. This embedded link can't be shown.
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. 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.
2. 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 Generate word doc action Fill in the required parameters, then click + Add more > Additional options Add a key-value pair for any variables you put in your template doc, where the “Placeholder” is the name of the variable without curly braces (ex: “Customer Name”) and the “Value” is the column from your data table (or other formula, such as Today()) that you want to replace it with. Set the “Results Column” to your URL column
3. 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
4. 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
5. 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 GenerateWordDoc formula. Exporting to PDF
Prefer a PDF? The pack also includes a GeneratePDF formula that works exactly like GenerateWordDoc — same template, same tag-value pairs — but the link downloads a PDF instead. Placeholder and conditional tags render identically.
Follow the same steps above, but when setting up your “Generate URL” button in step 2, select the Generate PDF action instead of Generate word doc Click your “Download” button as before — the link now downloads a PDF of the same document Note: PDF generation runs through a conversion service, so an export may take a few extra seconds compared to a Word doc.