Learn more about sending email, using templates, and using expressions with workflow in the Workflow: Sending Email section.
You can control the content and format for your email body and attachment with a template, contained in either a Google Docs or Microsoft Word document. Your template may include:
- Variables that refer to column values in your tables
- Expressions that yield computed values
- Start Expressions that display the rows of a table.
- If Expressions that allow you to include or exclude portions of a template.
The email body or attachment will contain your template with all variables and expressions evaluated and replaced with the resulting values, as described below.
You can use template files for both event-triggered and scheduled reports. The templates for both are largely identical, differing only in the start expression used to select the table rows being displayed.
Template Data Sources
We support Google Docs template files stored on these data sources:
- Google Drive
We support Microsoft Word template files stored on these data sources:
- Google Drive
- Microsoft Office 365
- Microsoft OneDrive
If you wish to use a workflow template, your account must include one or more of these data sources. Add a new data source from the Account > Data Sources tab.
Creating a Workflow Template
You can ask AppSheet to create a sample template file that displays the rows in your tables that you can then customize as you see fit. This makes template creation much easier.
Create a sample template file as follows:
- Add a new workflow or report and save it for the first time. Alternatively, open any existing workflow or report.
- Click the Create button following either the Attachment Template or Email Body Template property. When you click Create, AppSheet will create a sample template and write it to your default data source.
- The template will be given a unique name based on the workflow or report name, the template type (i.e., Attachment or Body), and the date and time you click Create, ensuring every template has a unique name.
- Click View to view and edit the new template file.
The Email Body Template always refers to a single Google Docs or Microsoft Word doc template file. You cannot use an expression to specify the Email Body Template file. If you need to choose between two or more template files, define a separate workflow rule for each template file and specify an expression in the Condition property to select which workflow rule to invoke.
Controlling the Workflow Template Data Source
By default, the template is created on your default data source. For example, if your default data source is Google, the Create button will create a Google Docs template file on Google Drive. If your default data source is Box, Dropbox, Microsoft Office 365, or Microsoft OneDrive, the Create button will create a Microsoft Word doc template file on your default data source.
The Editor fields Email Body Template Data Source and Attachment Template Data Source indicate which data source contains your template files.
You can control which data source is used by clicking the Browse icon and selecting a Google Docs or Microsoft Word doc template file using the Get data from ... dialog box. If you click the Create button after doing so, the created template will be saved on the data source you selected while browsing.
Google Docs and Microsoft Word Workflow Templates
You can use Google Docs or Microsoft Word documents as workflow templates. We recommend this because it allows you to easily and precisely control the appearance to your email body and attachment. To learn more see Google Docs Templates or Microsoft Word Templates.