🧾 Automate medical billing with Google Sheets and Gmail

796 views · 🧾 Invoice Processing

Description

Automate Medical Billing with Google Sheets and Gmail

Note: This template is designed for self-hosted n8n instances. The workflow image above shows the complete automation flow.

This n8n workflow automates the patient billing process—from form submission to invoice generation, email delivery, and Google Sheets logging.


🏥 Who is this for?

This workflow is ideal for:


💡 What problem does this workflow solve?

Medical billing often involves repetitive data entry, invoice calculation, and communication. This workflow:


⚙️ What this workflow does

This automation builds a streamlined billing system that:

  1. Captures patient info via an embedded n8n form
  2. Formats visit dates for professional presentation
  3. Calculates invoice totals based on treatment selection
  4. Sends email invoices to patients using Gmail
  5. Logs billing data into Google Sheets
  6. Notifies admin via Slack if submission is incomplete

✅ Setup Instructions

🔑 Prerequisites

Before starting, ensure you have:


📋 Step 1: Google Sheet Setup

Create a new Google Sheet and add the following columns in the first row (must match exactly):

Invoice No | Patient Name | Email | Date | Total Cost | Line Items | Payment Status

> ✅ Customizable: You can add columns like “Insurance Provider” or “Payment Status” if needed—just update the mapping in the Google Sheets node.


🗂️ Step 2: Configure Google Credentials in n8n

In n8n:


🧾 Step 3: Configure Treatment Pricing

In the Calculate prices code node:

const treatmentPrices = {
  "General Consultation": 60,
  "Blood Test - Basic Panel": 45,
  "Blood Test - Comprehensive": 120,
  "X-Ray - Single": 80,
  "Physical Therapy Session": 75,
  "Vaccination - Standard": 40,
  "Specialist Consultation": 120,
  "Minor Procedure": 150
};

> ✏️ Customizable: Add, remove, or change treatment names and prices.


🌐 Step 4: Embed the Patient Billing Form

In the On form submission node:

> ✏️ Customizable: Modify the form fields to include phone number, insurance info, etc.


📬 Step 5: Customize the Email Template

Open the Send Patient Invoice Email node:

Example message:

Hi {{ $json.patientName }},

Thank you for visiting MediSure Clinic on {{ $json.formattedDate }}.
Here is a summary of your treatments:
{{ $json.lineItems }}

Total Due: **${{ $json.totalCost }}**

Best regards,  
MediSure Billing Department

> ✏️ Customizable: Adjust the message, branding, and subject line to match your practice.


🧠 Step 6: Handle Errors

The Error Check and Generate Error Message nodes ensure:

> ✏️ Customizable: Replace Slack with email, webhook, or CRM notification if preferred.


🧾 Step 7: Log to Google Sheets

The Log Invoice to Googlesheets node appends each record:

> ✏️ Customizable: You can change the target spreadsheet or sheet name.


🔄 Testing

Once configured:

  1. Toggle the workflow Active

  2. Submit a test form

  3. Check:

    • Email receipt is accurate
    • Data is correctly appended in Google Sheets
    • No errors are logged

✨ How to Customize This Workflow

ComponentHow to Customize
Treatment PricesEdit Calculate prices node code
Form FieldsModify the On form submission node
Email BodyChange message in Send Patient Invoice Email
Slack AlertsReplace Slack node with email or CRM action
Google Sheet FieldsAdd/remove columns and update mappings

🧩 Integrate with Your Stack

Add downstream automations easily:


🛠️ Troubleshooting

IssueFix
Email not sentCheck Gmail credentials & quotas
Spreadsheet not updatingConfirm sheet ID and column names
Pricing not accurateReview Calculate prices logic
Slack alert not sentCheck webhook URL format

🤝 Need Help?

🔗 Nodes Used

Google Sheets, HTTP Request, Gmail, n8n Form Trigger

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup