๐Ÿงพ Generate invoices, save to Drive and send email to customer with JS + G Sheets

โšก 8,126 views ยท ๐Ÿงพ Invoice Processing

Description

This workflow automates invoice generation from form submissions, ensuring unique order IDs, creating PDF invoices, storing files, emailing customers, and logging invoice data โ€” all seamlessly integrated.


๐Ÿ”น Workflow Overview

  1. Trigger (Webhook) Starts when an order form is submitted, capturing customer and order details.

  2. Generate Random Order ID A Function node creates a unique alphanumeric invoice ID (e.g., INV-X92B7D).

  3. Check for Duplicate Order ID Google Sheets looks up the generated order ID in your invoice log sheet to prevent duplicates.

  4. Conditional Check (IF Node)

    • If the ID already exists โ†’ regenerates a new ID (loops back)
    • If unique โ†’ proceeds to invoice creation
  5. Prepare Invoice Data A Set node formats customer info, date, order items, and the unique order ID to fit your invoice template.

  6. Convert HTML to PDF HTTP Request node sends your invoice HTML to the RapidAPI HTML-to-PDF service and receives the PDF file.

  7. Upload PDF to Cloud Storage Save the PDF in Google Drive or Dropbox with a clear file name like Invoice-INV-X92B7D.pdf.

  8. Send Invoice Email to Customer Email node attaches the PDF and includes the order ID in the email subject/body.

  9. Log Invoice Details Append invoice data (customer info, order ID, total, PDF link) to your Google Sheet for tracking.


โš™๏ธ Node Details & Setup

1. Webhook Trigger

2. Function: Generate Random Order ID

3. Google Sheets: Lookup Row

4. IF Node: Check Order ID Existence

5. Set Node: Prepare Invoice HTML

6. HTTP Request: Convert HTML to PDF

7. Google Drive (or Dropbox) Upload

8. Email Node

9. Google Sheets: Append Row


๐Ÿ“ Google Sheets Template

You can make a copy of the invoice log template here

This sheet includes columns for order\_id, customer name, email, total, and invoice PDF link. Customize it as needed.


๐Ÿ“Œ Additional Notes


Need help or want a custom workflow?

Reach out via email at joseph@uppfy.com.

๐Ÿ”— Nodes Used

Send Email, Google Sheets, HTTP Request, Webhook, Google Drive

๐Ÿ“ฅ Import

Download workflow.json and import into n8n: Workflow menu โ†’ Import from File

๐Ÿ“– Importing guide ยท ๐Ÿ”‘ Credential setup