How to create Google Docs automatically

Automate document creation with Baserow and Google Docs

Creating and managing documents can be a time-consuming and tedious task, especially when you need to create multiple documents that follow a similar format. However, with the right tools, you can automate this process and save yourself time and effort.

By using Baserow in conjunction with Make and Google Docs, you can create a powerful document creation and management system. This streamlined process makes it easy to generate documents from your Baserow data. Whether you’re creating reports, invoices, or other documents, this workflow helps you complete the task quickly and efficiently.

What we’ll do

In this tutorial, we will explore how you can use Make to dynamically create documents from Baserow and Google Docs. We will walk you through the steps required to set up this workflow and provide you with some tips and tricks to help you get started.

Here’s an overview of the steps involved:

  1. Create a template in Google Docs.
  2. Set up a Baserow database.
  3. Set up a trigger in Make to watch for new rows in a Baserow table.
  4. Create an action in Make to create a new document in Google Docs using a template.
  5. Populate the fields in the Google Docs template.
  6. Save the newly created Google Docs document to a designated folder.

What we’ll need

We’ll integrate no-code tools. These are the tools we need:

  • A free Baserow account to act as the source of data
  • Make to connect Baserow with different apps and automate workflows between them.
  • Google account to use Google Docs

With these, you can dynamically create documents from Baserow and Google Docs using Make.

Dynamically create documents from Baserow and Google Docs

1. Create a template in Google Docs

We will create a template document where the curly brackets ({{}}) are used. With this template, you can dynamically generate new documents and send them via email to the recipients.

Here is an example:

{{Address}}
{{Phone number}}
{{Email}}
{{Today’s date}}

Dear {{FirstName}}, 

Introduction: Point of Contact

You signed up for Baserow a few days ago, and I'd like to take this opportunity to introduce myself as your Point of Contact.
We enjoy hearing about the use cases that new users have in mind. Should we schedule a brief introductory call this week? 

Sincerely,
Josh Smith
Marketing Manager

Now that we have our template, we will create a Baserow database with corresponding field types.

2. Set up a Baserow database

First, log in to Baserow. Storing data in a Baserow database makes it easier for everyone on the team to access and work with the data.

Create a workspace by clicking the + Create workspace button in the dashboard. Name the workspace, then click the Add workspace button to save the newly-created workspace.

After you’ve created a workspace, create a new database from scratch or add a database from the template library.

For this tutorial, we will create a database from scratch with the following field types:

Field name Field type
Name Single line text
Address Long text
Phone number Phone number
Email Email

Set up a Baserow database

3. Watch for new rows in a Baserow table

There are several ways to sync Baserow and Google Docs, but the simplest is to use an integration tool such as Zapier or Make. This setup can be done in minutes and saves the stress of having to create documents manually.

We will set up a trigger in Make to watch for new rows in a Baserow table. This will automatically create a new document from a template whenever a user is added to the table.

To get started, create a Make account or log into your existing account. Create a new Make scenario.

A Make scenario is comprised of a series of modules that indicate how data should be transferred and transformed between apps/services:

4. Create a Baserow connection

Make enables you to automate repetitive processes without writing code by connecting Baserow to over 1000 apps and services with ease.

  • Select Baserow as the trigger app and choose the “Watch Created Rows” trigger. This will trigger the workflow when new rows are created.
  • Connect to Baserow by selecting an existing connection or adding a new connection.
  • Enter the Baserow table ID that contains the rows you want to use to create new documents. You can find the table ID by clicking on the three dots next to the table. It’s the number between brackets.
  • Add a new row to the table in Baserow and run the scenario in Make.

Make will attempt to find a recent spreadsheet row in Baserow to use in the Zap. The data can then be used as test data in an action step later.

Create a Baserow connection

5. Create a new Google Docs document

Next, we want to create a copy of the existing template document and replace any tags, e.g., {{name}}, {{email}}.

  • Choose Google Docs as the action app and select the “Create a Document from a Template” action. This module also allows users to replace images with new images with URLs.
  • Establish a connection to your Google account.
  • Connect to your Google account and select an option to create a document from a template.
    • By Mapping - select this option to map the document template.
    • By Dropdown - select this option to choose the document template from the drop-down menu.
  • Choose a Drive to retrieve the template.

6. Populate the fields in the Google Docs template

Next, we will use the data from the new Baserow row to populate the fields in the Google Docs template.

Enter the values that will be entered instead of the variables in the new document. Map the document with the variables ({{}}) to use as the template for the new document.

The document created earlier contains tags which will be retrieved to use for the new document. The {{name}} variable in the source document will be displayed as the name field here, where the value can be mapped from the Baserow result, for example, John. Map the Baserow fields to the corresponding fields in the Google Docs template.

Make sure to format the data in the correct way for the field (e.g. dates, numbers, text). Use the format function formatDate(date; format; [timezone]) to get a current date from the now variable in the format "December 12, 2019.” without the current time stamp. Refer to Make’s documentation on tokens for date/time formatting.

Populate the fields in the Google Docs template

7. Save the newly created Google Docs document

Once the new document has been populated, we will need to save it to a designated folder in Google Drive.

  • Title: Create a name for the new document using fields from Baserow, e.g., {{First Name}} {{Last Name}} - {{Date}}.
  • New Drive Location: Select the drive to create the document.
  • New Document’s Location: Select or map the folder where the new document will be saved.

And that’s it! A new document will be generated every time a new row is created.

Save the newly created Google Docs document

This workflow can save you time and effort by automating the document creation process and making it easy to generate documents from your Baserow data.

Summary

Using Make, Baserow, and Google Docs together can be a powerful way to streamline your document creation process. By automating the process of creating new documents from Baserow data, you can save time, reduce errors, and ensure that your documents are always up to date.

In case you’ve run into an issue while following the tutorial, feel free to reach out to ask for help in the Baserow community.

What’s your use case? Tell us how you use Baserow