Automated PDF Document Generation and Distribution - n8n Workflow

Use this powerful n8n workflow to automate bulk PDF generation from Google Sheets data, saving documents to Google Drive, and emailing them via Gmail. Perfect for contracts and invoices.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • HR Professionals needing to send bulk job offers or contracts.

  • Finance teams automating invoice or pay slip generation.

  • Businesses looking for robust, data-driven document automation using an n8n workflow.

  • Users searching for efficient n8n templates for document processing.

Overview

Generating personalized business documents—like job proposals, contracts, or invoices—from structured data often becomes a repetitive and time-consuming manual task. This expert n8n workflow provides a complete solution, transforming raw data from Google Sheets into polished, legally compliant PDF documents. By utilizing CraftMyPDF for generation, the workflow ensures dynamic field mapping and high-quality output. Every step is automated: data extraction, document creation, secure archiving in Google Drive, and immediate distribution using a dedicated Gmail n8n node. This specific n8n workflow greatly enhances operational efficiency, making it one of the most valuable n8n templates for data-to-document tasks.

How it Works

The entire process is initiated using a manual n8n trigger, designed for batch processing. The workflow begins by utilizing the Google Sheets n8n node (Get employees) to query a specified spreadsheet, retrieving all rows that have not yet been marked as processed. The Split In Batches n8n node then ensures that each document request is handled sequentially.

For each item, the CraftMyPDF n8n node (Create agreement) maps the Google Sheets data (names, addresses, positions) to a predefined PDF template ID, generating a unique document. An If n8n node (Success?) verifies the successful creation of the PDF. If successful, an HTTP Request n8n node (Get agreement) downloads the newly created PDF file into the n8n workflow memory.

Next, the file is simultaneously handled by two n8n nodes: the Google Drive n8n node (Upload agreement) archives the file with a dynamically generated filename, and the Gmail n8n node (Send email with PDF) sends the document as an attachment to the corresponding email address listed in the original sheet data. Finally, a second Google Sheets n8n node (Update row) marks the processed row as 'DONE', ensuring this robust n8n workflow does not duplicate efforts upon subsequent executions of the n8n trigger.

Installation Guide


  1. Preparation: This n8n workflow requires preliminary setup. Clone the example Google Sheet linked in the sticky note within the workflow JSON. Create an account on CraftMyPDF and design your desired PDF template, then copy its Template ID.

  2. Importing the n8n template: Copy the provided JSON data and import it into your n8n instance.

  3. Credentials Setup:

Google Sheets: Provide credentials to access the source spreadsheet.
Google Drive: Provide credentials for the folder where the resulting PDFs will be archived.
CraftMyPDF: Set up your API credentials for document generation.
Gmail: Configure your OAuth2 credentials for the Gmail n8n node to send emails.

  1. Configuration: Update the 'Create agreement' n8n node with your specific CraftMyPDF Template ID. Ensure the Google Sheets n8n node references your cloned sheet's Document ID and sheet name. This powerful n8n workflow is ready to execute.

Node Details

When clicking ‘Execute workflow’ (Manual Trigger): This n8n trigger manually initiates the flow for batch processing.
Get employees (Google Sheets n8n node): Function: Reads data from the target Google Sheet, filtered to only retrieve rows that have not been marked as 'DONE'. Key Configuration: Read operation, filtering enabled on the 'DONE' column.
Create agreement (CraftMyPDF n8n node): Function: Generates the PDF document by dynamically injecting data from Google Sheets (names, addresses, position) into the configured template. Key Configuration: Requires a predefined Template ID.
Success? (If n8n node): Function: Directs the flow only if the document generation step returns a 'success' status, ensuring no failed documents are processed further.
Get agreement (HTTP Request n8n node): Function: Downloads the PDF file content using the temporary URL provided by the CraftMyPDF n8n node, converting the file into binary data for subsequent steps.
Upload agreement (Google Drive n8n node): Function: Archives the generated PDF into a designated folder. Key Configuration: File name dynamically constructed using the 'FIRST NAME' and 'LAST NAME' fields from the sheet data.
Send email with PDF (Gmail n8n node): Function: Composes and sends a personalized email, attaching the PDF downloaded by the HTTP Request n8n node. Key Configuration: Send To field is dynamically set using the 'EMAIL' column from the sheet.
Update row (Google Sheets n8n node): Function: Marks the row in the source spreadsheet as processed ('x') using the row number, preventing reprocessing by this effective n8n workflow.

Related n8n Workflows

Free

Nodes: 10 Nodes
Updated: December 26 2025
View all
Created by

Full-stack Web Developer based in Italy specialising in Marketing & AI-powered automations. For business enquiries, send me an email at [email protected] or add me on Linkedin.com/in/davideboizza

Featured*