Automated Invoice Generation from Spreadsheet Data to Documents - n8n Workflow

Use this n8n workflow to automatically generate structured invoices. Read financial data from Google Sheets, utilize Google Docs templates, and replace placeholders instantly using core n8n nodes.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Finance teams and small businesses needing automated invoicing.
Users looking for powerful Google Sheets automation capabilities within n8n.
n8n specialists who want to leverage Google Docs for automated document generation.
Anyone looking to deploy robust, repeatable n8n templates for accounting tasks.


  • Users seeking a practical example of a manual n8n trigger for batch processing.

Overview

Manual invoice creation is time-consuming and prone to errors. This efficient n8n workflow solves this by providing a hands-free method to transform structured billing data into professionally formatted documents. The value provided is high-speed, accurate bulk document generation. Using this n8n automation, you can maintain all billing data in a centralized Google Sheets location, and then, upon execution of the n8n trigger, the system automatically fetches the data, clones a pristine Google Docs template, and uses the n8n node capabilities to perform text replacement on critical placeholders (like Invoice#, Amount#, etc.), delivering ready-to-send invoices directly to a specified Google Drive folder. This is a highly scalable solution leveraging core n8n functionality.

How it Works

This specific n8n workflow is designed for manual initiation to handle batch processing of invoices:


  1. Manual Execution: The process begins with the manual n8n trigger node, allowing on-demand execution.

  2. Data Fetch: The n8n workflow simultaneously fetches the required invoice line items from a designated Google Sheets document and loads the raw content of the Google Docs template.

  3. Document Creation: An n8n node creates a brand-new Google Doc for the invoice, dynamically naming it based on the invoice data pulled from Google Sheets, and places it in a target Drive folder.

  4. Data Combining: The subsequent n8n node, Merge, combines the newly created document's metadata (ID) and the content fetched from the static template. This ensures all subsequent update steps have the necessary data available.

  5. Content Insertion: The template content is inserted into the newly created document using a Google Docs update operation.

  6. Placeholder Replacement: The final step involves a series of targeted replaceAll commands executed by an n8n Google Docs node. This node iterates through the document, replacing template placeholders (e.g., FromCompany#) with the precise corresponding values retrieved earlier by the Google Sheets n8n node, completing the automated invoice.

Installation Guide


  1. Import the n8n workflow JSON: Copy the provided JSON and import it directly into your n8n instance using the Workflows interface (New -> Import from JSON).

  2. Set up Google Sheets Credentials: Configure the 'Google Sheets' n8n node with OAuth2 access. Ensure the associated user has read access to your source Google Sheet. You must enable the Google Sheets API in the Google Cloud Console.

  3. Set up Google Docs Credentials: Configure all Google Docs n8n nodes with Google Docs OAuth2 credentials. This user must have read access to the invoice template and write access to the destination Google Drive folder.

  4. Prepare the Template: The n8n workflow requires a Google Docs template containing specific placeholders: FromCompany#, ToCompany#, Terms#, Invoice#, Description#, and Amount#. Update the documentURL parameter in the 'Get Invoice Template' n8n node to point to your template's ID.

  5. Configure Destination and Source: Update the spreadsheet details in the 'Google Sheets' n8n node and the target folderId in the 'Create New Doc' n8n node to match your source data spreadsheet and your desired output folder, respectively.

Node Details

This n8n workflow utilizes several key n8n nodes to achieve end-to-end automation:

When clicking ‘Execute workflow’ (manualTrigger n8n node):
Function: Provides a simple, manual execution method for running the entire n8n workflow on demand, useful for batch generation or testing. This is the starting n8n trigger.
Google Sheets (n8n node):
Function: Reads all relevant invoice data (Company names, amounts, terms) from the specified Google Sheets document, providing the payload for subsequent document creation.
Key Configuration: Reads from a predefined sheet ID and sheet name (Sheet1).
Get Invoice Template (GoogleDocs n8n node):
Function: Fetches the raw text content of the dedicated Google Docs template document that defines the invoice structure.
Key Configuration: Uses a static documentURL pointing to the template ID.
Create New Doc (GoogleDocs n8n node):
Function: Creates a new Google Docs file in Drive, dynamically naming it using an expression based on the current item's invoice number (e.g., Invoice: {{ $json.Invoice }}). This prepares the final output document.
Key Configuration: Title set via expression; a fixed folderId is specified for output storage.
Merge (n8n node):
Function: Combines the outputs from the template fetch and the new document creation, ensuring that the next step has both the new document ID and the template content simultaneously.
Key Configuration: combineAll mode.
Input Invoice Details (GoogleDocs n8n node):
Function: Performs the critical data injection step. This n8n node executes multiple replaceAll actions to substitute template placeholders (like Invoice#, Amount#) with corresponding dynamic data derived from the initial Google Sheets input. This finalizes the logic of the n8n workflow.

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.

Featured*