Customize content using templates in an automation as described in the following sections:
- Customize content using templates
- Tips and tricks from the AppSheet Community
- Create a template
- Manually create a template
- Use an existing template
- Configure the data sources for storing templates
Customize content using templates
Templates, using formats such as Google Docs or Microsoft Word, enable you to more precisely control the appearance of content sent from an automation bot.
When configuring your bot, you can use templates to customize the following content:
In general, you can include the following content in a template:
- Text
- Images
- 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 final result will contain the template contents with all variables and expressions resolved.
Use templates in both event-triggered and scheduled bots; the templates will be nearly identical, differing only in the Start expression used to select the table rows being displayed.
AppSheet supports the content types defined in the following table for templates. Learn more about creating and customizing templates for a particular content type using the links provided.
Template
Supported content types
Email body
Email attachment
File
Webhook
- CSV
- FORM_URL_ENCODED (Webhooks only)
- Microsoft Excel (XLSX)
- HTML
- JSON
- PDF (source from Google Docs or Microsoft Word )
- ICS/iCalendar calendar invitation
- XML
SMS
For additional template formatting tips and examples, see the following topics:
- Use and troubleshoot custom fonts in templates
- Display images, thumbnails, drawings, and signatures in templates
- Display Address, LatLong, and XY values in templates
- Use CONCATENATE(), Ampersand operators, and text expressions in templates
- Sample email templates
Tips and tricks from the AppSheet Community
Learn tips and tricks for using templates from the AppSheet Community:
Create a template
Create a template as described in the following table. See also Create a Microsoft Word template on Google Drive .
Template
Steps
Email body
- Create and save or open an existing Send an email task.
- Disable Use default content?
- Click Create adjacent to the Email Body Template property.
For more information, see Send an email from a bot .
Email attachment
- Create or open an existing Send an email task.
- Disable Use default content?
- Set the content type using the Attachment Content Type property.
- Set the Attachment File Store property to the file system where you want your attachments to be saved.
- Click Create adjacent to the Attachment Template property.
For more information, see Send an email from a bot .
File
- Create or open an existing Create a new file task.
- Set the HTTP Content Type property to the desired value.
- Set the File Store property to the file system where you want files to be saved.
- Click Create adjacent to the Template property.
For more information, see Create and save a file from a bot .
SMS
Webhook
- Create or open an existing a Call a webhook task.
- Set the HTTP Content Type property to the desired value.
- Set the Body Template Data Source to the desired data sour ce .
- Click Create adjacent to the Body Template property.
If you are using the webhook to invoke the AppSheet API, configure the webhook URL
value when configuring the webhook
before clicking the Create
button. AppSheet examines the webhook URL value to determine if the AppSheet API is being invoked. If so, AppSheet uses the table name you specify following /tables/
in the URL to determine the field values to include in the JSON body template.
If your table contains a List of Refs to related child records, the created JSON Body Template file will include a Start expression that extracts the data values of all child records of the parent record. If the child table contains a List of Refs to related grandchild records, the created JSON Body Template file will include a Start expression that extracts the data values of all grandchild records of the child records. The created JSON Body Template file will extract the parent record, the child records, the grandchild records, the great grandchild records, and so on. This allow you to extract the entire hierarchy of records.
For more information, see Call a webhook from a bot .
In each case, AppSheet creates the template and writes it to your default data source unless it is explicitly set. To explicitly set the data source, see Configure the data sources for templates (below).
By default, AppSheet uses the following file naming conventions similar to the following to ensure the template name is unique: Content/ task-name
_BodyTemplate_ yyyymmdd_hhmmss
Content/ task-name
_AttachmentTemplate_ yyyymmdd_hhmmss
Click View to view the template and customize the template , as required.
Note : The template properties reference a single template file. You cannot use an expression to specify the template file. If you need to choose between two or more template files, define a separate event for each template file and specify an expression in the Condition property to select which event to invoke.
Manually create a template
You can manually create a template and upload it to one of the the data sources described in Configure the data sources for templates . Then, follow the steps in the next section, Use an existing template .
Use an existing template
To use an existing template:
- Create or open an existing task.
- Disable Use default content? (if applicable).
- Click the Browse icon adjacent to the template property.
- Select the data source using the Get data from... dialog box when prompted, then select an existing template file.
- Click View to view the template and customize the template , as required.
Configure the data sources for storing templates
To use templates, your account must include one or more of the supported data sources listed below. To add a new data source, see Use multiple data sources .
AppSheet supports the following data source for Google Doc template formats:
-
Google Drive
AppSheet supports the following data sources for all other template formats:
- Box
- Dropbox
- Google Drive
- Microsoft Office 365
- Microsoft OneDrive
When creating a template, the template is created on your default data source unless it is explicitly set. For example, if your default data source is Google, when you click Create , the new template is created on your Google Drive. Similarly, if your default data source is Box, Dropbox, Microsoft Office 365, or Microsoft OneDrive, when you click Create , the template file is created on that data source.
To explicitly set the data source to use for a template:
- Set the associated Data Source or File Store property, if applicable.
- Click the Browse icon adjacent to the template property and select the data source using the Get data from... dialog box, then select an existing template file.
- Note : If you click Create after browsing for an existing template file, the new template will be saved to the data source you selected while browsing.