Select Page
Function - Google Docs Create/Export
Function - Google Docs Create/Export

Function - Google Docs Create/Export

The Google Docs Function allows you to automatically create documents inside Google Docs using your Airtable data. You can generate single page and multi-page documents that display a single record or list of records from your Airtable base. It will also automatically upload the newly created PDF file back into your Airtable base in an Attachment file and the Google Doc URL into a URL or Text field. Use Cases: Invoices, Quotes, Form Entries, Contracts, Reports, and more

image

Features:

  • - Automatically generate documents with your Airtable data
  • - Create single or multi-page documents
  • - Bulk create documents for multiple Airtable records or create documents per single record
  • - Use dynamic conditions to create documents based on criteria from your Airtable base
  • - Save as a PDF back to an Attachment field in your Airtable base
  • - Save the Google Doc URL back to a URL or Text field in your Airtable base
  • - Tables in your document automatically created to match the number of records needed
  • - Add advanced formatting with specific in-document templates for tables, images, links, content, and grids.

For even more advanced documents, you can set up multiple document templates based on conditionals from your Airtable data and you can use the custom formatting templates inside your document for Tables, Text, Numbers, Dates, Images, Links, and Grids.

Pre-Made Google Docs Templates

To help you get started, copy one of our Google Docs pre-made templates. You can replace the placeholders with your Airtable field and table names, then customize the rest of the document to fit your needs.

Before Setting Up the Google Docs Function

Before setting up the function in On2Air, create your document template(s) using our Google Docs Template Guide.

Google Docs Template Guide

Getting Started in On2Air

General Function Configuration

In the On2Air Actions app:

  • Click Create New Function ✔
  • Choose your Function
  • Click Add Configuration

Add Source Connection and Source Configuration

Source Connection

Source Configuration

  • Select Your Base - Choose the Airtable base you need for documents
  • Select Your Table - Choose your table
  • Select Your View - Choose your view (Optional) Default is all views
image

Set Trigger Mode

Trigger Mode

Trigger Mode Options

Trigger Mode - The mode type for the field in your base being used for functions. Determines how your function starts and processes

**Options** * Checkbox * Field Updated * Date * Formula * Last Modified Time * Record IDs * All View Records

image

Modes Available

MODE: Checkbox

  • A checkbox field monitored to initiate the function

Mode Configuration (Checkbox)

Checkbox Field - The Airtable checkbox field you want to monitor

Trigger On - Determines if the trigger is initiated when the checkbox field is Checked or Unchecked

MODE: Field Updated

  • A specific field monitored for changes in order to update and sync data to a second field

Mode Configuration (Field Updated)

Updated Field - The field being monitored to initiate the function * This can be any Airtable field type * If using a Multi-Line Text field, the Comparison Field must also be a Multi-Line Text Field * Currently, cannot be a Rich-Text formatted field (Airtable bug)

Comparison Field - The field being updated/changed once the function is processed * Must be an Airtable text field type * If using a Multi-Line Text field in the Updated Field, the Comparison Field must also be Multi-Line Text

MODE: Date

  • The specific Date field being monitored for changes in order to update and sync the date to a second Date field type or Text field type
  • Also works with Formula fields - Be sure your formula contains valid date formatting
  • Triggers once the date and time specified has passed
  • Ex: If Date is 8/15/20 11:30AM, it will process AFTER 11:30AM has passed on 8/15/20, even though the fields are out of sync because you changed the date

Mode Configuration (Date)

  • Date Field - The Date field being monitored to initiate the trigger Must be an Airtable Date field type
  • Comparison Field - The Date field type or Text field type being updated/changed once the trigger is processed Must be an Airtable Date field type or a Text field type

MODE: Formula (Advanced)

  • Create your own custom formula to initiate a trigger

Mode Configuration (Formula)

  • Formula - Add your own custom formula

MODE: Last Modified

  • A specific Last Modified field in your table

Mode Configuration (Last Modified)

Last Modified - The Last Modified Time Field in your table you want to monitor and use for updates/changes

Buffer - The amount of time between when the Last Modified Time field changes and when the trigger begins Useful when typing in a text field and Airtable automatically saves your text which changes the last modified field. The buffer time prevents the trigger from running too quickly.Options * No Buffer * 5 Minutes * 10 Minutes * 30 Minutes * 1 Hour

MODE: Record IDs

  • Record ID can be used if you want to use a script from a button click. Y

You will submit your Record IDs in Installation and any record IDs will be pulled in.

This mode is only seen in Base Management Functions

MODE: All View Records

  • All Records in the View specified will be processed every call. Use with caution to avoid unnecessary function calls.

🎥 Generate a Google Docs File from your Airtable Data

Watch the video or read further for set up instructions

Google Docs Function Configuration

Source Template Configuration

Google Connection (Required) - Select a Google Connection to use

Source File Mode (Required) - Select source to use for creating new files

Source File Mode Options - Document Creation Type

Create Blank Doc - Create a new blank document in Google Docs

Use a Single Template - Use a single template file to create a new merged file(s) with your Airtable data. This is the most common 'template' option.

Use Dynamic Templates - Use multiple template files based on a specific condition, like a Single-select field option, in your Airtable data to create multiple different files with your data.

Example: Your Airtable table contains a Single-select field called Category. Each Category needs a different variation of the document template. You might have Category options for First-Time Customer and another for Repeat Customer. Based on the Category you choose in your Airtable base will determine which template is used for document creation.

Make & Use Copy of a Single Template - Use a single template file as your main template to create a new file(s) with your data. This is useful for making changes to the document and continuing to edit it after a merge.

Make & Use Copy of Dynamic Templates - Use multiple template files based on a unique identifier in your Airtable base data to create multiple new files with your data. This is useful for making changes to the document and continuing to edit it after a merge.

Example: Your record contains a Single-select field. You can choose to create a new document with specific information depending on the option you choose from your Single-select field.

Use Existing Airtable Record Field Value - Use a field in Airtable where you already have a source file URL

Existing Source Field (Required for Existing Airtable Record Source Folder Mode) - Choose your Airtable URL field

Source File

Source File (Required for Single Template) - Choose your Source Template Google Docs File to copy and create when the Function processes - This is the template you’ve already created Must be signed into your Google account

Dynamic Field for Matching Source Files (Required for Dynamic Templates) - Select a field to be used as a unique condition for creating new documents. Once configured, this field will determine which files to create according to your unique identifier.

  • Match Value- This is the unique conditional name option you have listed in Airtable. Type each one exactly as seen in your Airtable field options. Example: If your Client Type single-select field contains Easy, Medium, and Hard, you will have 3 Match Values - Easy, Medium, and Hard.

Select Match Source File - For each Match Value, you will choose the template for the file you want create. You can click Remove if you need to remove the selection

Default Source File - You can set files to be copied and created as a default for any values/unique identifiers not listed in Match Values. If you don't choose any files in this options, no file will be copied and created if no match values are found.

Destination Configuration

Destination Folder Mode (Required) - Select the folder in your Google Drive where you want to save your newly created documents

OPTIONS:

Save All Files in Single Parent Folder - Save all files in a single root folder

Dynamically Save Files into Different Folders - Save files into different folders based on a unique condition and identifier (example: Single-select option) Useful to combine this one with the On2Air Create Google Folder Function

Destination Folder URL Already stored in a Record Field - Choose the field in your Airtable base where the Destination Folder URL is already stored.

Dynamically Save to Folder Name With Field Value - Will auto-create folders within the selected parent folder based on the value of a field. Great for dynamic folder creation for large number of values.

Destination Folder (Required for 'Save All Files in Single Parent Folder' option) - Select the destination folder for newly created files

Dynamic Field for Matching Destination Folders (Required for 'Dynamically Save Files into Different Folders') - Select a field from your Airtable that determines which folder to save files to. Once configured, you will be able to choose an option from the field and files will be saved in their correct folder.

Match Value (For Dynamic Files)- This is the unique identifier name option you have listed in Airtable. Type each one exactly as seen in your Airtable field options.

Example: If your Client Setup Type single-select field contains Easy, Medium, and Hard, you will have 3 Match Values - Easy, Medium, and Hard.

Destination Folder (for Matches) - Choose the folder that corresponds with your Match Value. Choose a Destination Folder for each Match Value.

Example: If your Match Value is Easy, you might want to save all files related to 'Easy' records in a folder called 'Ready Clients'

Default Destination Folder (Recommended to Set a Default Folder) - Set a default folder for any values/unique identifiers not listed in Match Values. If you don't choose a folder as default, no files will be created or stored if no match values are found.

New Document Name and Airtable Storage Field

New File Title - Create the title for the new file. Use {{FIELDNAME}} placeholders to dynamically insert values from the record.

Example: Use the name of the Client listed in your Airtable base and the word Invoice’ as the new file title. If your field name in Airtable is Company Name, enter {{Company Name}} Invoice as the file title. If left blank, will use the source file name.

Source File URL Storage Field (Optional) - Used for the actual template file, not the merged file. Select Airtable URL Field or Single Line Text Field to store the Google URL for the template file

If left blank, then output file will be deleted upon completion of function call (unless exporting as a URL) This URL option will only save your template file URL, not the newly created file that's based on your field placeholders. If you're creating new documents from templates containing Airtable field placeholders, you may want to leave this blank.

If Airtable Field Value Exists (Required if File URL Storage Field is used) - If the URL Storage Field already has a URL value in it (the file already exists) you can choose to do nothing, replace the URL, or use the existing.

OPTIONS:

Finish/Do Nothing - This will ensure no changes or updates are made to the URL Storage Field and will leave it as-is. Will not perform any merge/export either.

Replace with New and Keep Old - Current file will be replaced with new one. Old file will remain in Google Drive. Any Merge/Export will use New File.

Replace with New and Delete Old - Current file will be replaced with new one. Old file will be DELETED. Any Merge/Export will use New File.

Use Existing - No New File will be created and Existing File will not change. Any Merge/Export will use existing File.

Merged Output Configuration for New Document

This determines how or when your document is created

OPTIONS:

No Record Merge - Record Merging not needed

*Always Merge Record (recommended) - Perform a Record Merge on every execution to create documents every time

Merge on File Creation Only - Perform a Record Merge only when a new destination file is created

Merge on Existing File Only - Perform a Record Merge only when there was an existing destination file already stored in record

Merge Output URL Storage Field (Optional) - Select an Airtable field to store the Merged file URL If left blank, then merged file will be deleted upon completion of function call (unless exporting as a URL).

Delete Previous Merged File - When selected, if a previous merge file exists, it will be deleted after the new merged file is created

Export Output Configuration - Where Your Document is Exported

This allows you to choose how you want your new document exported

Export File

Generate an Exported File and Save to an Attachment or URL Field

Options:

No Export File- No export needed

Export Merged File (recommended) - Perform an export of the merged file This option is most useful if you want to save the newly created document in your Airtable base

Export Saved File - Perform an export of the saved file instead of the merged file

Export Format

Select the format for the exported file.

OPTIONS:

PDF HTML File Text File MS Word

Export to Airtable

Exported File Storage Field (Required for Exports) - Select the Field in your Airtable base to store the Exported file(s). Can be an Attachment, Single-line Text, or URL Field type

Attachment Fields will download and save the file(s). Single Line/URL fields will save the URL(s)

Export Placement - Upon Export, select how to insert the file into the Attachment Field

OPTIONS:

Remove all existing attachments then attach new one - Remove any attachments from the field and then attach the new one

Append new attachment(s) to end of existing ones - Add new attachment to the end of all existing attachments

Prepend new attachment(s) to beginning of existing ones - Add new attachment to the beginning of all existing attachments

Export to Google Drive

Save Exported File in Google Drive

If enabled (green), this will save the exported file in the Google Drive Destination Folder

Saved Exported File Storage Field (Required if Enabled) - Select the Airtable Field to store the Google URL of exported file stored in Google Drive

Delete Previous Export File

If selected, if a previous export file exists, it will be deleted after new export file is created.

File Permissions

Set file permissions on the newly created file

Copied File Permissions - Determines permissions on the original output file

OPTIONS:

No Modifications - Leave as-is. Will default to your global Drive or folder permissions Anyone with Link Can Read - People can view, but can’t change or share the file with others. Anyone with Link Can Edit - People can make changes, accept or reject suggestions, and share the file with others. Anyone with Link Can Comment - People can make comments and suggestions, but can’t change or share the file with others.

Merged File Permissions - Determines permissions on the merged output file

OPTIONS:

No Modifications - Leave as-is. Will default to your global Drive or folder permissions Anyone with Link Can Read - People can view, but can’t change or share the file with others. Anyone with Link Can Edit - People can make changes, accept or reject suggestions, and share the file with others. Anyone with Link Can Comment - People can make comments and suggestions, but can’t change or share the file with others.

Advanced Settings

Last Updated (Optional) - Select your Last Updated field in Airtable to keep track of latest updates to document record

Save Function

  • Click Save Action Function Details

Test Your Function

Before using your Function, you must test it.

Install Your Function