Preparing a Google Docs-to-PDF workflow with n8n: a local demonstration

Build a local n8n document demo that validates template fields and generates a sample PDF, with clearly separated Google Docs, Drive and delivery setup steps.

Sample project using fictional data, not a client case study. Google Docs, Drive and email are not connected in this demo.

This n8n example turns a fictional project-summary template into a real PDF. It validates three fields, merges them into local template text, and produces a one-page document that can be inspected from the final node.

It also prepares the text-replacement request body for a future Google Docs connection. The PDF in this demonstration is rendered locally; it is not a Google Docs export. Storage is marked simulated and delivery is marked not-sent.

Three fictional fields are validated and merged into local template text. A Google Docs request is prepared but not sent, and a one-page PDF is rendered locally. Drive storage is simulated and email is not sent.

Give the template a clear input contract

The sample uses three placeholders:

1Client: {{client_name}}
2Service: {{service}}
3Scope: {{scope}}

The fictional values describe a sample landing-page project. Missing fields stop generation. An unknown placeholder also stops it, so the workflow cannot silently produce a report containing an unresolved template tag.

The renderer is deliberately limited to one page and ASCII text. It rejects unsupported characters and overlong lines. These limits make the local sample inspectable; a real document service needs appropriate fonts, wrapping and layout tests for its intended content.

Separate preparation from the cloud connection

The Code node constructs a Google Docs batchUpdate replacement body from the same field mapping used by the local merge. That request body is an output to inspect, not a request that has been sent.

For a real Google Workspace implementation, Google's documented pattern is to copy the template through Drive and apply text replacements to the copy through Docs. The copied document can then be exported as a PDF through Drive. These are integration steps to configure and test after connecting an authorized account. See Google's document-merge guide and Drive's export guide.

A complete deployment would also need a destination folder, delivery recipient, access policy and failure handling. This demonstration does not claim that any of those external operations ran.

Inspect the result

Both the exported workflow and its local tests generated a PDF with fictional content. The document was parsed, rendered and visually checked. The tests also confirmed that missing values, unknown placeholders and unsupported layout inputs reject generation.

Import the inactive sample into a local n8n workspace and run it manually. Download: document workflow export (JSON, about 4.7 KB) and the fictional sample PDF it produces (PDF, about 1.2 KB). Both are demonstration files, and the PDF is rendered locally, not exported from Google Docs. The last node contains merged text, the proposed Google Docs replacement body and the PDF binary. No credentials or live documents are required.

Adapt the pattern to your documents

Start with one template and a small set of fields. Define what an acceptable finished document looks like before adding cloud storage and delivery.

For help connecting a document workflow to your business systems, see automation services or send a short brief with the template, data source and intended recipient.

Have a similar problem?

Send a short brief describing your platform and what you want to fix or build. See the services for the kinds of work I take on.