Skip to main content

Auto-generate and auto-fill business documents with Google Sheets & Gmail

Workflow preview

Workflow preview
100%
Auto-generate and auto-fill business documents with Google Sheets & Gmail preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

This workflow automates the generation and delivery of personalized business documents (e.g., contracts, job offers, invoices, pay slips ) in PDF format . The data source is a Google Sheet , and th...

Best for

  • Document Extraction automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

n8n-nodes-base.manualtrigger, n8n-nodes-base.splitinbatches, n8n-nodes-base.googlesheets, n8n-nodes-craftmypdf.craftmypdf, n8n-nodes-base.httprequest, n8n-nodes-base.googledrive, n8n-nodes-base.stickynote, n8n-nodes-base.if

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Davide.

Original n8n.io source

1.1 Workflow description

Title
Auto-generate and auto-fill business documents with Google Sheets & Gmail
Workflow name
Auto-generate and auto-fill business documents with Google Sheets & Gmail

This workflow automates the generation and delivery of personalized business documents (e.g., contracts, job offers, invoices, pay slips) in PDF format. The data source is a Google Sheet, and the documents are created using CraftMyPDF, then uploaded to Google Drive and optionally sent via email.

This workflow is ideal for bulk document generation (contracts, invoices, etc.) with minimal manual intervention.


Benefits

  • Fully Automated: Once triggered, it handles the whole pipeline end-to-end—no manual editing or document creation needed.
  • Customizable: Works with any type of business document as long as you provide a CraftMyPDF template.
  • Scalable: Processes multiple entries in batch, ideal for HR departments or finance teams.
  • Integrated: Seamlessly connects Google Sheets, CraftMyPDF, Google Drive, and Gmail.
  • Trackable: Updates the original spreadsheet to keep track of which documents have been processed.

Requirements

  • Self-hosted n8n instance (required for some advanced node usage).
  • Google Sheet template with columns like: FIRST NAME, LAST NAME, ADDRESS, etc.
  • A CraftMyPDF account with a ready-made template.
  • Google OAuth2 credentials for Sheets, Drive, and Gmail integrations.

How It Works

  1. Trigger & Data Fetch:

    • The workflow starts with a manual trigger ("When clicking ‘Execute workflow’").
    • It retrieves employee data from a Google Sheet ("Get employees"), filtering rows where the "DONE" column is empty.
  2. PDF Generation & Processing:

    • The "Loop Over Items" node processes each employee record individually.
    • The "Create agreement" node uses CraftMyPDF to generate a PDF contract, populating it with employee details (name, address, email, etc.).
    • A conditional node ("Success?") checks if PDF creation was successful.
  3. PDF Handling & Notifications:

    • The PDF is fetched ("Get agreement") and uploaded to Google Drive ("Upload agreement") with a filename like [First-Name]-[Last-Name].pdf.
    • An email with the PDF attachment is sent to the employee via Gmail ("Send email with PDF").
  4. Tracking & Completion:

    • The Google Sheet row is updated with "x" in the "DONE" column ("Update row") to mark completion.
    • The workflow merges results and loops until all records are processed.

Set Up Steps

  1. Prerequisites:

    • Use the self-hosted version of n8n (required for this workflow).
    • Clone the provided Google Sheet template.
  2. Configure CraftMyPDF:

    • Create an account on CraftMyPDF.
    • Design a PDF template and note its Template ID. Insert this ID in the "Create agreement" node.
  3. Credentials Setup:

    • Connect nodes to:
      • Google Sheets (to fetch/update data).
      • Google Drive (to store PDFs).
      • Gmail (to send emails).
      • CraftMyPDF (for PDF generation).
  4. Customization:

    • Adjust field mappings in the "Create agreement" node to match your PDF template placeholders.
    • Modify the email template in "Send email with PDF" as needed.
  5. Execution:

    • Run the workflow manually. It will process all rows lacking a "DONE" marker, generating PDFs, sending emails, and updating the sheet automatically.

Need help customizing?

Contact me for consulting and support or add me on Linkedin.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - When clicking ‘Execute workflow’

Type / Role
n8n-nodes-base.manualTrigger - manualTrigger
Config choices
Version 1

Block 2 - Loop Over Items

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 3 - Get employees

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.6

Block 4 - Create agreement

Type / Role
n8n-nodes-craftmypdf.craftMyPdf - craftMyPdf
Config choices
Version 1

Block 5 - Get agreement

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 6 - Upload agreement

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 7 - Update row

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.6

Block 8 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 9 - Success?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 10 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 11 - Merge

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 12 - Send email with PDF

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

3. Summary Table

Workflow Auto-generate and auto-fill business documents with Google Sheets & Gmail
Complexity intermediate
Nodes 12
Categories Document Extraction
Author Davide
Published 07 Jul 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/5745/5745.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Auto-generate and auto-fill business documents with Google Sheets & Gmail do?

This workflow automates the generation and delivery of personalized business documents (e.g., contracts, job offers, invoices, pay slips ) in PDF format . The data source is a Google Sheet , and th...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Document Extraction use case.