PDF Document Data Extraction and AI Drafting Pipeline - n8n Workflow

Automate document creation using n8n. Trigger an n8n workflow when a new PDF is uploaded to Google Drive, extract data using OpenAI, and generate a professional draft document with email notifications.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Professionals handling large volumes of legal, financial, or technical PDFs who need to rapidly create drafts.

  • Automation specialists looking for advanced n8n templates using LangChain agents and Google services.

  • Users needing to convert unstructured PDF data into organized, draftable documents automatically.

  • Teams seeking to streamline document creation and notification processes using a reliable n8n workflow.

Overview

Manually converting key information locked inside complex PDFs into usable, structured document drafts is time-consuming and prone to human error. This powerful n8n workflow solves this by creating a robust, end-to-end automation pipeline. When a PDF file is dropped into a monitored Google Drive folder, the n8n trigger starts the process. The file content is extracted, analyzed by an OpenAI drafting agent (using GPT-4) for synthesis and summary, and then automatically written into a new Google Document. The final step of this sophisticated n8n template is sending a Gmail notification with a summarized key point list and the direct link to the newly created draft. This setup leverages multiple interconnected n8n node capabilities to deliver highly accurate, ready-to-use professional documents, drastically improving efficiency.

How it Works

This powerful n8n workflow initiates immediately upon the Google Drive Trigger detecting a new file creation event (it is configured to watch a specific 'AIFolder').


  1. The newly created PDF is downloaded using the Download Google Drive n8n node, and the Extract from File n8n node processes the binary data to retrieve the raw text content.

  2. A custom Aggregate Extract Text Code n8n node ensures that all extracted text is combined into a clean, single variable (combinedtext) for optimal AI input.

  3. The Information Extractor n8n node uses a robust prompt against an OpenAI model to pull specific structured data (like dates, names, and references) from the text, laying the foundation for the draft.

  4. The Drafting Agent (an OpenAI n8n node configured with a powerful GPT model like GPT-4.1-mini) synthesizes all extracted information into a formal, structured, professional draft document.

  5. The draft content is then used to create a new file via the CREATE GOOGLE DOC n8n node, which is subsequently populated by the UPDATE Google Docs n8n node, saving the final document back into Google Drive.

  6. The Email Summary Agent uses an efficient model (GPT-4o-mini) to generate a concise, 3-5 point summary of the drafted content specifically for the notification email.

  7. Finally, the Send Email n8n node (Gmail) delivers the final notification. The email includes the AI-generated summary and the access URL (prepared by the Edit Email Message n8n node) to the completed draft. This reliable n8n workflow ensures instant conversion and user notification.

Installation Guide

To install this n8n template, follow these steps:


  1. Import Workflow: Import the provided n8n workflow JSON into your n8n instance.

  2. Credentials Setup: You must configure credentials for the following services, ensuring proper connections for every n8n node:

Google Drive/Docs: Requires OAuth2 credentials. Ensure the account has read/write access to the monitored folder.
OpenAI: Requires an API key credential for the LLM agents used for drafting and summarizing.
* Gmail: Requires OAuth2 credentials set up to allow the Send Email n8n node to send the final notification.

  1. Google Drive Trigger Configuration: Locate the Google Drive Trigger n8n node and verify that the folderToWatch ID is correctly set to the Google Drive folder where you intend to upload your PDFs.

  2. Recipient Update: In the Send Email n8n node, ensure you change the sendTo parameter from the placeholder address to your desired notification recipient.

  3. Once all credentials are set and configurations are verified, activate the n8n workflow to begin automation.

Node Details


  • Google Drive Trigger: The starting n8n trigger. It operates in watch mode, monitoring a specific Google Drive folder for new file creation events, instantly initiating the n8n workflow.

  • Download Google Drive: Downloads the binary content of the file detected by the n8n trigger.

  • Extract from File: A specialized n8n node configured for pdf operation. It extracts the raw text content from the binary data, making it readable for subsequent AI processing.

  • Aggregate Extract Text (Code): A custom Code n8n node responsible for robust data preparation. It concatenates all extracted text chunks into a single clean variable (combined_text) required by the LLMs.

  • Information Extractor (LangChain): An advanced n8n node utilizing the connected OpenAI Chat Model. It performs structured data extraction based on a detailed system prompt, pulling specific fields like names, dates, and addresses from the text.

  • Drafting Agent (OpenAI): The primary generative n8n node. It uses a high-capacity model (GPT-4.1-mini) to professionally summarize and synthesize the complex raw text into a coherent, structured draft document.

  • CREATE GOOGLE DOC / UPDATE Google Docs: These sequential n8n node actions handle the output. They create a new Google Doc file and then insert the AI-generated draft content into it, saving the final document back into Google Drive.

  • Email Summary Agent (OpenAI): Generates a short, focused summary (3–5 key points) suitable for the email notification, using the fast GPT-4o-mini model.

  • Send Email (Gmail): The final n8n node in the pipeline. It sends the completion notification email, including the AI-generated summary and the direct link to the new Google Doc, closing the automated n8n workflow loop.

Related n8n Workflows

Free

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

I’m passionate about using n8n to create realistic workflows that help working class people simplify their daily tasks. My workflows aim to make life easier by eliminating mundane, repetitive responsibilities that take up valuable time. I love turning automation into a tool that lets people focus on what matters most to them.

Featured*