Creating the Template

You can create a Google Docs email template file as described here.

Viewing or Editing the Template

Once the template is created, click the View button to view or edit the template.

Including an Image in the Template

Your Google Docs template can include can include one or more images.

To include an image:

  1. Open the template in Google Docs

  2. From the Google Docs menu select Insert > Image and select the image you wish to include.

When Google Docs exports the template as HTML, it will:

  1. Save the image on Google Drive.

  2. Create a URL to the saved image file.

  3. Include the URL in the exported HTML template in place of the image.

When the template is used as an email Body template, the resulting HTML email body will contain the image URL. The email client that displays the HTML email body will use the image URL to retrieve and display the image.

When the template is used as a PDF Attachment template, the HTML to PDF conversion web service will retrieve the image using the image URL contained in the HTML file. The HTML to PDF conversion web service will then include the image in the resulting PDF file.

Including an Image URL in the Template

Your Google Docs template can include one or more image URLs. Each image URL must refer to a publicly accessible image.

Template Formatting Tips

The following tips may help you control the appearance of your PDF attachments.

  1. Under Format > Line spacing, reduce the line spacing to Single if it is currently larger, such as 1.5, Double, etc.

  2. Under Format > Line spacing, remove Add space before paragraph and Add space after paragraph.

  3. Under Format > Paragraph styles, change the header formatting to Normal Text rather than Heading 1, Heading 2, etc. Then apply formatting to control the header's font size, color, boldness, etc.

  4. Remove any excess blank lines.

  5. Under File > Page setup..., check the page size and margins. For example, consider setting the page size to A4 and reducing the top and bottom margins.

Google Docs Template in HTML Format

The Google Docs template is read in HTML format when it is retrieved by AppSheet. AppSheet then replaces the template variables in the HTML template with the data values you specify. The resulting HTML document becomes the email body or attachment. For email attachments, we convert the HTML document to PDF format and add the result as the attachment.

When you are designing your template, it can be helpful to see what your template looks like in HTML format. This allows you to fine tune your Google Docs template to yield better looking HTML.

  1. Open the template in Google Docs.

  2. In the Google Docs File menu, click Download as and select Web Page (.html zipped).

  3. If you are using the Chrome browser in Windows, the browser will download the file as a zip file and display a message at the bottom of your browser window.

  4. Click the up arrow and select Show in folder.

  5. Right-click on the zip file and select Extract All .... This will extract the HTML file from the zip file.

  6. Double-click on the extracted HTML file to view it in the browser.

Page Breaks in PDF Attachments

You can include page breaks in the PDF file created from an attachment template file by manually inserting a page break in Google Docs.

  1. In Google Docs, position the cursor where you want the page break to occur.

  2. From the Google Docs Insert menu, select Page break.

Page Headers, Page Footers, and Page Numbering are Not Supported

Workflow templates do not support automatic page headers, page footers, or page numbering. 

To handle automatic page headers, page footers, and page numbering, we would need to implement a “page layout engine” that computes the page location of each element being displayed. We would need to be aware of page boundaries, so that we could:

  • Insert a footer at the end of each page.

  • Insert a bottom margin at the end of each page.

  • Insert a top margin at the start of each new page.

  • Insert a header at the start of each new page.

  • Insert appropriate page numbers.

We do not support any of these features because implementing a “page layout engine” is a lot of work. It is not work that we have done.

Using Custom Fonts

You can use custom fonts in your Google Docs template file. The resulting PDF attachment file will use these custom fonts.

Do this as follows:

  1. Open your Google Docs template file in Google Docs.

  2. From the fonts dropdown on the Google Docs menu bar, select "More fonts ...".

  3. In the "Fonts" dialog box that is displayed, look at "My fonts" on the right side of the dialog box.

  4. If the font you wish to use is not displayed, use the "Search" box to find the font. For example, you can use the "Libre Barcode" fonts. To choose one or more of these fonts, enter "Libre Barcode" in the "Search" box. This should display a list of five "Libre Barcode" fonts. Fonts you are using should be displayed in blue text with a checkmark to their left. If a font is missing, click it and the font should be displayed in blue text with a checkmark to its left.

  5. In your workflow template, select the text you wish to assign a custom font, and select the font name from the "Fonts" dropdown on the Google Docs menu bar.

  6. Trigger your workflow rule and ensure the PDF attachment is using the custom font.

Some customers have reported problems when using custom fonts. The PDF service sometimes fails to convert the HTML file to PDF correctly when custom fonts are present. The resulting PDF document may not display the text using the custom font at all. If you encounter problems with custom fonts, see Troubleshooting Custom Fonts .

Did this answer your question?