FlowKit

Automating Google Drive with n8n: filing, extraction, and document pipelines

Published 26 July 2026 · 6 min read

Google Drive is often a small company's real information system: supplier invoices land in one folder, signed contracts in another, résumés arrive by email and then end up "somewhere on the Drive". As long as a human files everything by hand, it holds — until the day nobody can find the March invoice. n8n's Google Drive node turns this passive storage into an active document pipeline: detect every new file, extract its content, file it, rename it, pull structured data out of it, even index it for an AI assistant. This guide covers the OAuth2 connection, the trigger, the key operations, then three concrete pipelines that build on each other naturally.

Connecting Google Drive: the OAuth2 credential

As with Google Sheets, the Google Drive node authenticates via OAuth2, not a simple API key. The Google Cloud Console side follows the same principle: create (or reuse) a project, enable the Google Drive API, configure the OAuth consent screen, then create an OAuth client with the redirect URL that n8n displays in the credential creation screen. Back in n8n, you paste the Client ID and Client Secret, start the connection flow, and authorize the Google account that owns — or has access to — the folders you want to automate. n8n stores the token encrypted.

Two production tips: use a Google account dedicated to automation rather than an employee's personal account, and grant it access only to the folders involved. A workflow that can move and delete files across the entire company Drive is an incident waiting to happen.

The Google Drive Trigger: the building block of every pipeline

The Google Drive Trigger node starts a workflow when something changes in Drive. Two events cover most document needs:

  • File Created in a watched folder: the flagship case. A "To sort" folder becomes the single entry point for all documents, and every drop kicks off the pipeline.
  • File Updated: useful for resyncing a document that's already indexed (for example re-vectorizing a documentation Google Doc when it's edited).

The trigger works by polling: n8n queries Drive at a regular interval and compares against the previous state. So it's not strict real time, and more importantly this mechanism can produce duplicates — a file uploaded in several steps or modified right after creation can trigger two executions. We come back to this in the pitfalls section, because it's the number one flaw of Drive pipelines in production.

The Google Drive node's key operations

The node covers a file's entire lifecycle:

  • Download: fetches the file's content as binary data into the workflow. Important point: for Google-native formats (Docs, Sheets, Slides), there's no "file" to download as such — the node offers an export conversion (a Doc as PDF or plain text, a Sheet as CSV). For a PDF or an image uploaded as-is, the binary arrives unchanged and a node like Extract from File will pull the text out of it.
  • Upload: sends a binary to a target folder, with a chosen name and MIME type — the natural output of a workflow that generates a report or an archived document.
  • Move and Copy: move or duplicate a file to another folder. Move is the heart of automatic filing; Copy is for when the same document needs to live in two hierarchies (accounting and legal, for example).
  • Update: renames a file or modifies its metadata — essential for normalizing names ("2026-07-invoice-acme.pdf" rather than "scan_final_v2 (1).pdf").
  • Share: adds permissions (a user, a domain, a link) — handy for automatically sharing a validated document with the right recipient.
  • List / Search: finds files by name, type, or parent folder — the building block of batch processing and catch-up jobs ("reindex all PDFs in the contracts folder").

Pipeline 1 — Automatic filing with AI

The highest-payoff pipeline for a small organization: a single "To sort" folder where everyone drops everything, and a workflow that files it for you.

  1. Google Drive Trigger (File Created) on the "To sort" folder;
  2. Download with text export for Google Docs, or Extract from File for PDFs;
  3. an AI node classifies the document into your categories: invoice, contract, résumé, quote, other — with structured output (type, counterparty, detected date);
  4. a Switch node routes by type, then Move relocates the file to the right folder and Update renames it following a fixed convention (date, type, counterparty).

The classification logic — prompt, categories, confidence threshold with a "to review" folder for ambiguous cases — is detailed in our guide on AI-powered filing of incoming documents. The stakes go beyond convenience: research on personal information management, notably the work of Bergman, Beyth-Marom and Nachmias on the "user-subjective" approach (JASIST, 2003 — see on Google Scholar), shows that a misfiled document is paid for in re-finding time and errors, and that relevant filing is filing that matches the context of use (project, client) rather than a rigid hierarchy designed in the abstract. In other words: a naming convention and a folder structure applied automatically and systematically beat the most elegant taxonomy applied every other time.

Pipeline 2 — Data extraction to a spreadsheet or a database

The second stage: not just filing the document, but extracting its data. The typical case is supplier invoices:

  1. trigger on the "Invoices" folder (fed by hand or by pipeline 1);
  2. Download the PDF, extract the text;
  3. an AI node with structured output extracts supplier, amounts before and after tax, date, due date, and invoice number;
  4. the row goes to Google Sheets (Append or Update Row, key: invoice number) or to Supabase for a more robust setup.

The AI side — extraction prompt, field validation, handling scanned invoices — is covered in depth in our guide on extracting data from PDF invoices with AI. The Drive + extraction duo turns a folder of PDFs into a queryable table, with no manual data entry.

Pipeline 3 — Feeding a RAG from Drive

The third and most powerful stage: every document dropped in Drive becomes queryable by an AI assistant. The ingestion pipeline:

  1. File Created trigger (and File Updated for revisions) on the reference folders;
  2. Download with text export, then split the content into coherent pieces — size and overlap strategies are detailed in our guide on document chunking for RAG;
  3. generate embeddings and insert into Supabase pgvector, with the Drive file ID as metadata so you can delete or re-vectorize a document;
  4. on the query side, an AI agent runs its vector search and answers with citations.

The full setup — pgvector schema, similarity function, agent — is described in our RAG guide with n8n and Supabase, and the PDF-to-Supabase-pgvector ingestion workflow provides the ready-made building block to plug into your Drive trigger.

Pitfalls to know about

  • Large files and n8n memory. A Download loads the binary into memory; a 2 GB video or a batch of heavy scans can bring the instance to its knees. Filter by MIME type and size at the very start of the workflow, and only download what the pipeline knows how to process.
  • Drive API quotas. Like all Google APIs, Drive enforces per-minute, per-project request limits. A workflow that lists then downloads hundreds of files in a tight loop will end up with 429 or 403 "rate limit exceeded" errors: process in batches and space out large catch-up jobs.
  • Trigger duplicates. This is the most common trap: multi-step uploads, a file modified right after creation, an instance restart. The fix is the same as for webhooks: make the workflow idempotent by logging the Drive ID of every processed file and short-circuiting executions you've already seen — the full mechanism is described in our guide on idempotency and duplicate prevention.
  • Permissions and shared folders. The credential's account must have sufficient rights on the target folder: reading can work while moving fails, and a Shared Drive follows inherited permission rules that catch people off guard. Test each operation (Download, Move, Update) with the real account before going to production.

Going further

An automated Drive changes in nature: from a drop zone where information gets lost, it becomes the first stage of a document system — filed, named, extracted, queryable. If your next step is an assistant that answers from your documents, the RAG Assistant Pack provides the complete ingestion and query workflows, ready to plug into the Drive trigger described in this guide.

FAQ

Frequently asked questions

Does n8n's Google Drive Trigger detect files in real time?

No. Like the Google Sheets Trigger, it works by polling: n8n queries the watched folder at a regular interval (every minute by default) and compares the state with the previous check. Expect a delay of a few seconds to a few minutes between a file being dropped and the workflow firing — plenty for a document pipeline, but worth keeping in mind if you promise 'instant' processing.

How do I get the text content of a Google Doc with n8n?

Google Docs, Sheets, and Slides are not regular binary files: the Google Drive node's Download operation offers on-the-fly conversion. Pick an export format (plain text or PDF for a Doc, CSV for a Sheet) and n8n receives the converted content, ready to pass to an extraction node or an AI model. For a PDF uploaded as-is, use the Extract from File node after the download instead.

Why does my Drive workflow process the same file twice?

The trigger can fire more than once for the same file: multi-step uploads, a modification right after creation, or an n8n restart that replays the last interval. The fix is idempotency: store the Drive file's unique ID in a table (Data Tables or Supabase) and check for it at the start of the workflow. If the ID is already known, the workflow stops without reprocessing the document.

Can n8n watch a Shared Drive?

Yes, the Google Drive node and trigger support Shared Drives, provided the Google account used for the OAuth2 credential has access with sufficient rights. Classic pitfalls: a folder shared 'via link' doesn't show up in the list until it has been added to the account's Drive, and inherited permissions can block a file move even when reading works fine.

Bundle FlowKit Complet

€269