The process involves the following steps:
- Create a document template in Google Docs.
- Add a service account to the document (details below).
- In your n8n workflow, copy this document into a new file.
- Use the document modification node to replace placeholders (for example,
{client_name}
with the actual client’s name). - Convert the final document into a PDF and proceed with further workflow steps as needed.
This method lets you dynamically generate personalized PDFs based on a predefined template.
The process involves the following steps:
- Create a Template in Google Docs
- Set up a document with placeholders (e.g.,
{client_name}
,{invoice_number}
).
- Grant Access to a Service Account
- Create a Google Cloud service account and share the document with its email. Docs about google service accounts.
- Copy the Template in n8n (Google Drive Node)
- Use the Google Drive node to duplicate the template and work with a fresh copy.
- Replace Placeholders with Actual Data (Google Docs Node)
- The Google Docs node in n8n allows dynamic text replacement, personalizing the document. For example, you can find variable
{client_name}
inside your doc and replace it withJohn Doe
text.
- Convert to PDF and Continue Processing (Google Drive Node)
- Save the modified document as a PDF for further automation (e.g., emailing or storage) using Google Drive node.
Full step-by-step instructions, along with a ready-to-import JSON workflow, are available in the article:
Generating PDFs in n8n Using Google Docs.
Feel free to ask any questions about this flow.
I use it to generate docs for my Telegram Bot users.