Skip to main content

How do I create dynamic Google Docs from my app data?

In this episode, we'll learn how to integrate with Google Docs and Google Drive in order to copy a template Doc, automatically fill in the Doc, and share the Doc with an email address.

Features Discussed :

  1. Google Docs Pipe (Time: 3:14)

    Automate template text replacement in Google Docs using Tadabase data.

  2. Google Drive Pipe (Time: 12:33)

    Automate Google Drive tasks like creating or managing files from Tadabase.

  3. Form Record Rules with Pipes (Time: 13:34)

    Copy templates from Drive into Tadabase using record data via record rules.


Transcript Summary

Introduction

Hey everybody, and welcome back to another episode of Build It with Tadabase. In today's episode, we're talking about Google Docs and Google Drive and how we can integrate these two with our database application. We will create a template document, dynamically fill it with application data, and share it with another person for collaboration.

Overview of the System

Once we're done, we will be able to submit a form that sends all the data to a templated Google Doc. The system will:

  • Copy the Google Doc template.
  • Fill placeholders with record values.
  • Share the document with the intended user for collaboration.

We will also demonstrate how the Google Doc is created, shared via email, and how the recipient can collaborate.

Step 1: Creating the Google Docs Template

First, we need to go into Google Docs and create our template document. The idea is to have one source document (the template) that will be copied and filled with dynamic data every time it's needed. For this, we use the template from Google’s template gallery, specifically the "Simple Project Proposal."

  • Edit the template by removing unnecessary sections and replace the text with placeholder text for dynamic data insertion.
  • Use placeholders such as Project Name, Current Date, Overview Data, Specifications Data, Milestone 1, Milestone 1 Data, Milestone 2, and Milestone 2 Data in the template.

Step 2: Setting Up the Application in the Database

Inside our app, we’ll build the necessary functions to store and pass data to Google Docs:

  • Create three tables: Projects, Clients, and Google Doc Templates.
  • The Projects table will store all the project-related data to be passed to the Google Docs.
  • Each project will connect to a client and a Google Doc template.

Fields Setup:

  • For each placeholder in the Google Doc template, create corresponding fields in the Projects table: Project Name, Proposal Date, Overview Data, Specifications Data, Milestone 1, Milestone 1 Data, Milestone 2, Milestone 2 Data.
  • Add connection fields to link projects to clients and Google Doc templates.

Step 3: Configuring the Pipes

Next, we’ll install and configure two pipes: Google Docs and Google Drive. These pipes will allow us to manipulate documents and files in Google Drive.

Pipe Setup:

  • Google Docs Pipe: Manipulate the content of the Google Doc.
  • Google Drive Pipe: Manage the file (copy, share).

Key Steps:

  1. Copying the Document Template:
  • Use the Google Drive pipe to copy the selected Google Doc template.
  • Pass the document ID from the template table and save the new document ID in the Projects table.
  1. Filling the Template:
  • Use the Google Docs pipe to replace the placeholders in the newly created Google Doc with values from the Projects table.
  • Map the placeholders in the template to the corresponding fields in the project (e.g., Project Name to Project Name).

Step 4: Building the Client Onboarding Page

Create a new page in the app for client onboarding:

  • The form will collect project details, client information, and the selected Google Doc template.
  • Set up form rules to run the pipes:
  1. Copy the Google Doc template and save the new document ID.
  2. Fill the new document with data from the project record.

Test the page by submitting a form and checking that the new Google Doc is created with the correct data.

Step 5: Sharing the Document

Once the document is created and filled, we’ll share it with the client. Add another rule to the form that uses the Google Drive pipe to share the document with the client:

  • Pass the file ID and the client’s email address.
  • Define a custom message to be sent along with the shared document.

Final Testing and Results

Test the final process by filling out the form, checking the Google Doc creation, and verifying that the document is shared via email with the intended collaborator. The client can open the document and start collaborating.

Conclusion

That’s how you can integrate Google Docs and Google Drive with your database application to create dynamic documents, fill them with data, and share them with collaborators. I hope you enjoyed this episode of Build It with Tadabase. Thanks for watching, and I'll see you next week!