AutomationFlowsEmail & Gmail › Google Sheets to CraftMyPDF & Gmail documents

Google Sheets to CraftMyPDF & Gmail documents

Original n8n title: Auto-generate and Auto-fill Business Documents with Google Sheets & Gmail

ByDavide Boizza @n3witalia on n8n.io

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…

Event trigger★★★★☆ complexity12 nodesGoogle SheetsN8N Nodes CraftmypdfHTTP RequestGoogle DriveGmail
Email & Gmail Trigger: Event Nodes: 12 Complexity: ★★★★☆ Added:

This workflow corresponds to n8n.io template #5745 — we link there as the canonical source.

This workflow follows the Gmail → Google Drive recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "UJPZC5iE3WG9H1xs",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Auto-Generate Business Documents in PDF",
  "tags": [],
  "nodes": [
    {
      "id": "171902dc-bc1e-41a0-bbde-f9ad294a25a8",
      "name": "When clicking \u2018Execute workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -440,
        -60
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "e506b2b6-4948-4fd5-b292-bb60de3584f6",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        80,
        -60
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "4621dd93-5acd-4c52-862d-859973a25cf2",
      "name": "Get employees",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -160,
        -60
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupColumn": "DONE"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1YQPuoEubRHJepRKdquks69Iqf2XdGVKfpWOdYwk3RMg/edit#gid=0",
          "cachedResultName": "Foglio1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1YQPuoEubRHJepRKdquks69Iqf2XdGVKfpWOdYwk3RMg",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1YQPuoEubRHJepRKdquks69Iqf2XdGVKfpWOdYwk3RMg/edit?usp=drivesdk",
          "cachedResultName": " Job Application\tPDFs"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "6a0caf1d-301e-49fb-8f7a-d902a80b8476",
      "name": "Create agreement",
      "type": "n8n-nodes-craftmypdf.craftMyPdf",
      "position": [
        340,
        -40
      ],
      "parameters": {
        "data": "={\n    \"first_name\": \"{{ $json[\"FIRST NAME\"] }}\",\n    \"last_name\": \"{{ $json[\"LAST NAME\"] }}\",\n    \"address_street1\": \"{{ $json.ADDRESS }}\",\n    \"address_street2\": \"\",\n    \"address_city\": \"{{ $json.CITY }}\",\n    \"address_state\": \"{{ $json.STATE }}\",\n    \"address_postal\": \"{{ $json[\"ZIP CODE\"] }}\",\n    \"address_country\": \"{{ $json.COUNTRY }}\",\n    \"email\": \"{{ $json.EMAIL }}\",\n    \"phone_number\": \"{{ $json.PHONE }}\",\n    \"position\": \"{{ $json.POSITION }}\"\n}",
        "resource": "pdf",
        "templateId": "30c77b239c7aa810"
      },
      "credentials": {
        "craftMyPdfApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "35b1c198-c56c-4826-91aa-664686bf3ca0",
      "name": "Get agreement",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        860,
        -60
      ],
      "parameters": {
        "url": "={{ $('Create agreement').item.json.file }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "1a7ce678-eb84-4213-a0ef-539854353e81",
      "name": "Upload agreement",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        340,
        200
      ],
      "parameters": {
        "name": "={{ $('Get employees').item.json[\"FIRST NAME\"] }}-{{ $('Get employees').item.json[\"LAST NAME\"] }}.pdf",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "1dksdhaLr6zt43_cyyLGdHCPsMajAM7FG",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1dksdhaLr6zt43_cyyLGdHCPsMajAM7FG",
          "cachedResultName": "Job Application"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "0024b884-2bc4-4c53-8d35-db61bb351880",
      "name": "Update row",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        860,
        260
      ],
      "parameters": {
        "columns": {
          "value": {
            "DONE": "x",
            "row_number": "={{ $('Loop Over Items').item.json.row_number }}"
          },
          "schema": [
            {
              "id": "FIRST NAME",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "FIRST NAME",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "LAST NAME",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "LAST NAME",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "ADDRESS",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "ADDRESS",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "CITY",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "CITY",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "STATE",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "STATE",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "ZIP CODE",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "ZIP CODE",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "COUNTRY",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "COUNTRY",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "EMAIL",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "EMAIL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "PHONE",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "PHONE",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "POSITION",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "POSITION",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "DONE",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "DONE",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "row_number"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1YQPuoEubRHJepRKdquks69Iqf2XdGVKfpWOdYwk3RMg/edit#gid=0",
          "cachedResultName": "Foglio1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1YQPuoEubRHJepRKdquks69Iqf2XdGVKfpWOdYwk3RMg",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1YQPuoEubRHJepRKdquks69Iqf2XdGVKfpWOdYwk3RMg/edit?usp=drivesdk",
          "cachedResultName": " Job Application\tPDFs"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "0c6b6f65-5331-4c80-8ad4-1e3d89361ecd",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -460,
        -360
      ],
      "parameters": {
        "width": 520,
        "height": 220,
        "content": "## PRELIMINARY STEPS\n\nOnly works with the self-hosted version of n8n\n- Clone this [Sheet](https://docs.google.com/spreadsheets/d/1YQPuoEubRHJepRKdquks69Iqf2XdGVKfpWOdYwk3RMg/edit?usp=sharing)\n- Create an account on [CraftMyPDF](https://app.craftmypdf.com/)\n- Create a new PDF template\n- Get the Template ID and insert it in the \"Create aggreement\" node"
      },
      "typeVersion": 1
    },
    {
      "id": "4cea2139-0fd1-4ec0-a48d-5adfcaad268f",
      "name": "Success?",
      "type": "n8n-nodes-base.if",
      "position": [
        580,
        -40
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "21203490-bc55-4981-95ed-50674887967b",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "success"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "0701598a-fdb8-4fd3-8b2d-14487c82bf8c",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -460,
        -620
      ],
      "parameters": {
        "color": 3,
        "width": 520,
        "height": 240,
        "content": "## Auto-Generate Business Documents in PDF\n \n\nThis workflow allows you to generate contracts in bulk (job proposals, general documents, pay slips, invoices, contracts, etc.) in PDF format, starting from a Google Sheet containing the data to be inserted.\n\nAfter creating a PDF template (using CraftMyPDF), this workflow manages the entire process, from filling out the PDF files, to sending emails with attachments, to archiving them on Google Drive (or an equivalent system), in a fully automated way."
      },
      "typeVersion": 1
    },
    {
      "id": "34ea77ea-cb4f-4227-be35-da9932f72111",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        580,
        260
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "18541572-a7fb-42b9-91ec-1275fd116ac7",
      "name": "Send email with PDF",
      "type": "n8n-nodes-base.gmail",
      "position": [
        340,
        380
      ],
      "parameters": {
        "sendTo": "={{ $('Get employees').item.json.EMAIL }}",
        "message": "=Hi {{ $('Get employees').item.json['FIRST NAME'] }} {{ $('Get employees').item.json['LAST NAME'] }},<br>\nAttached is our job proposal<br><br>\nBest,<br>\n[Company name]",
        "options": {
          "attachmentsUi": {
            "attachmentsBinary": [
              {}
            ]
          },
          "appendAttribution": false
        },
        "subject": "Job offer"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "eb1f9c9b-1b50-485e-ab00-ed35e51a9c97",
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Update row",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Success?": {
      "main": [
        [
          {
            "node": "Get agreement",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update row": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get agreement": {
      "main": [
        [
          {
            "node": "Upload agreement",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send email with PDF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get employees": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Create agreement",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create agreement": {
      "main": [
        [
          {
            "node": "Success?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload agreement": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send email with PDF": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Get employees",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

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…

Source: https://n8n.io/workflows/5745/ — original creator credit. Request a take-down →

More Email & Gmail workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Email & Gmail

This workflow ingests proof-of-delivery and completion documents from Gmail or a webhook, extracts key fields with an OpenRouter vision model, reconciles them against Google Sheets dispatch data, arch

Gmail Trigger, HTTP Request, Google Sheets +2
Email & Gmail

AICARE Email Blast System. Uses googleDrive, httpRequest, googleSheets, gmail. Event-driven trigger; 39 nodes.

Google Drive, HTTP Request, Google Sheets +2
Email & Gmail

Tiktok to video copy (paylaşılacak). Uses httpRequest, googleDrive, googleSheets, gmail. Event-driven trigger; 39 nodes.

HTTP Request, Google Drive, Google Sheets +1
Email & Gmail

Atlas Opco Import. Uses github, stopAndError, formTrigger, googleSheets. Event-driven trigger; 22 nodes.

GitHub, Stop And Error, Form Trigger +4
Email & Gmail

Shopify and E-Commerce store owners often struggle to create engaging 3D videos from static product images. This workflow automates that entire process—from image upload to video delivery—so store own

Form Trigger, Google Drive, HTTP Request +2