Google Sheets Invoice Generator using PDF.co - n8n Workflow

Automate PDF invoice creation directly from Google Sheets data using this powerful n8n workflow. Perfect for small businesses needing reliable, automated PDF generation.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

This n8n workflow is ideal for:

Small business owners and freelancers who manage billing data in Google Sheets.
Users looking for reliable, automated document generation solutions using n8n.


  • Developers needing a ready-to-use n8n template for integrating data extraction and PDF creation services.

Overview

This n8n workflow provides a robust solution for automating your invoicing process. Instead of manually copying data into a separate PDF tool, this n8n automation extracts raw line items from a designated Google Sheet, processes the data through a custom JavaScript n8n node for accurate calculations (tax, totals, unique invoice number generation), and uses the PDF.co API to render a beautifully formatted PDF document using a predefined HTML template.

This specific n8n template ensures standardization and speed. It significantly reduces manual effort and minimizes errors associated with repetitive data entry, allowing for instant, professional invoice creation whenever the n8n trigger is activated.

How it Works

This comprehensive n8n workflow proceeds through the following steps:


  1. Initialization: The workflow starts when the Manual Trigger n8n node is manually executed (or adapted to use a scheduled or webhook n8n trigger).

  2. Data Retrieval: The Google Sheets n8n node (Get Invoice Rows) connects to the specified spreadsheet and sheet, pulling all necessary row data (Description, Qty, Price, Customer Info) into the n8n workflow.

  3. Data Transformation (The Core Logic): The Code n8n node (Convert to html import) processes the raw array of sheet data. It performs critical tasks like normalizing input types, filtering invalid rows, calculating line totals, applying tax rates and discounts, generating a unique invoice number, and structuring all output data into a single, clean JSON object tailored for a Mustache templating engine. This is a crucial data preparation step within the n8n workflow.

  4. PDF Generation: The PDF.co n8n node (Create PDF) receives the finalized JSON object. Using the 'HTML Template to PDF' operation and a specific templateId, it dynamically merges the invoice data into the PDF.co template, generating the final professional PDF invoice document. This completes the primary goal of the n8n workflow.

Installation Guide

To deploy this powerful n8n workflow, follow these setup instructions:


  1. Import the n8n template: Copy the provided JSON code and paste it into your n8n canvas using the 'New' > 'Import from JSON' function.

  2. Google Sheets Credentials: Create a new Google Sheets OAuth2 credential in n8n. Log in with your Google account. In the 'Get Invoice Rows' n8n node, select this credential and specify your target Spreadsheet ID and Worksheet Name.

  3. PDF.co Setup: Create an account at PDF.co and obtain your API Key. In n8n, create a new PDF.co API credential and paste your key.

  4. PDF.co Template Configuration: This n8n workflow relies on a pre-made HTML template within PDF.co. You must create a new template in your PDF.co dashboard and copy the Template ID. Replace the placeholder templateId in the 'Create PDF' n8n node with your specific ID.

  5. Code Node Customization: Open the Code n8n node. Adjust constants like INVOICEPREFIX, TAXRATE, and company details (company object) to match your business needs.

Node Details

This n8n workflow utilizes several key n8n nodes:

When clicking ‘Execute workflow’ (Manual Trigger): The initiating n8n trigger for starting the process. Useful for testing or manual execution.
Get Invoice Rows (Google Sheets n8n node):
Function: Connects to Google Sheets to retrieve all rows containing invoice line item data.
Key Configuration: Requires specific Spreadsheet ID and Worksheet (Sheet1). Uses OAuth2 authentication.
Convert to html import (Code n8n node):
Function: Serves as the data manipulation and logic engine. It cleans, calculates totals (SubTotal, Tax, Grand Total), generates the invoice number, and transforms the relational data structure from Google Sheets into a single JSON object optimized for HTML templating.
Key Configuration: Contains custom JavaScript defining business rules (tax rate, prefixes, formatting).
Create PDF (PDF.co Api n8n node):
Function: Executes the PDF generation using the prepared JSON data and a specified PDF.co HTML template.
Key Configuration: Operation set to URL/HTML to PDF; Template Type set to htmlTemplateToPDF; requires a specific templateId and uses the JSON payload from the preceding n8n node as input data.

Related n8n Workflows

Free

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

Professional services consultant with over 10 years of experience solving complex business problems across industries. I specialize in n8n and process automation—designing custom workflows that integrate tools like Google Calendar, Airtable, GPT, and internal systems. Whether you need to automate scheduling, sync data, or streamline operations, I build solutions that save time and drive results.