🔓 Unlock all 10,000+ workflows & prompts free Join Newsletter →
✅ Full access unlocked — explore all 10,000 AI workflow and prompt templates Browse Templates →
Home n8n Workflow
January 22, 2026

Google Sheets to Gmail, payroll emails sent clean

Lisa Granqvist Partner Workflow Automation Expert

Payroll day shouldn’t feel like a scavenger hunt through spreadsheets, attendance logs, and half-finished calculations. But if you’re still copying numbers into emails by hand, one wrong cell can turn into five follow-up threads.

HR managers run into this monthly. Payroll specialists feel it even more. And founders doing HR “for now” get stuck in it fast. This payroll email automation pulls attendance and salary rows from Google Sheets and turns them into clean, employee-ready Gmail messages.

Below, you’ll see exactly what the workflow does, what it replaces, and how to adapt it to your rules for missing hours, absences, and deductions.

How This Automation Works

The full n8n workflow, from trigger to final output:

n8n Workflow Template: Google Sheets to Gmail, payroll emails sent clean

The Problem: Payroll Emails Get Messy, Fast

Payroll communication is one of those processes that looks “fine” until it isn’t. You start with an attendance sheet, then a salary sheet, then you calculate missing hours, absent days, and deductions. Now multiply that by 10, 25, or 50 employees. One small mistake (wrong EmpId match, outdated salary, missed absence) leads to awkward corrections, delayed approvals, and employees losing trust in your numbers. The worst part is the mental load: you’re doing math, formatting, and customer support all at once.

The friction compounds. Here’s where it usually breaks down.

  • You spend about 5–10 minutes per employee calculating and double-checking deductions, even when the rules never change.
  • Copying numbers into email templates invites errors, and you often only catch them after someone replies.
  • There’s no clean audit trail of what was sent, when it was sent, and what the final “official” breakdown was.
  • Employees ask the same questions because the message is inconsistent or doesn’t clearly explain missing hours and absences.

The Solution: Google Sheets → Gmail Payroll Emails, Automatically

This n8n workflow turns two Google Sheets into a monthly payroll email system that runs on schedule. It starts by pulling daily attendance logs (EmpId, date, in/out time, hours worked, status). Then it computes worked hours, missing hours, and absent days for the month. Next, it merges that attendance summary with your employee master salary sheet (salary, name, email) so each person has one complete record. From there, the workflow calculates hourly/daily rates, applies your deduction logic, and writes the final payroll report row back to an output sheet for tracking. Finally, GPT-4 generates a professional, HR-friendly summary and n8n emails it out through Gmail/SMTP, then logs the send status for audit.

The workflow starts on a monthly schedule trigger. Calculations happen in the middle (hours, absences, deductions, final salary), with Google Sheets acting as both the data source and the audit destination. Then the AI Agent produces a clear summary paragraph, and Gmail sends personalized messages to each employee without you rewriting the same explanation 30 times.

What You Get: Automation vs. Results

Example: What This Looks Like

Say you have 25 employees. Manually, you might spend about 8 minutes per person to total attendance issues, calculate deductions, and paste a clean breakdown into an email. That’s roughly 3 hours, and it’s the kind of work that still needs a second pass. With this workflow, you spend about 10 minutes checking the two Google Sheets for completeness, then the scheduled run generates the output rows and emails automatically. You get most of those 3 hours back, and the “did we send it?” question disappears because every send is logged.

What You’ll Need

  • n8n instance (try n8n Cloud free)
  • Self-hosting option if you prefer (Hostinger works well)
  • Google Sheets to store attendance logs and salary data.
  • Gmail (or SMTP) to send employee payroll emails.
  • OpenAI API key (get it from your OpenAI dashboard under API keys)

Skill level: Intermediate. You’ll connect accounts and may adjust a couple of calculation/code nodes to match your payroll rules.

Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).

How It Works

A monthly schedule kicks things off. n8n runs automatically on the cadence you choose (for example, the last day of the month or the first morning after close).

Attendance data gets cleaned and totaled. The workflow pulls your daily log from Google Sheets, then computes hours worked per day and totals missing hours and absent days for the month.

Salary rules are applied consistently. It fetches the salary master sheet, merges it by EmpId, then calculates hourly/daily rates and applies deductions to output a final salary number per employee.

Employees get a clear email, and you get an audit trail. The workflow appends the final results to an output sheet, generates an HR-friendly summary with GPT-4, sends the email via Gmail/SMTP, and logs the send status back to Google Sheets.

You can easily modify deduction rules to match your policy based on your needs. See the full implementation guide below for customization options.

Step-by-Step Implementation Guide

Step 1: Configure the Schedule Trigger

This workflow runs monthly and starts by pulling attendance data for processing.

  1. Add the Scheduled Automation Trigger node.
  2. Set the trigger rule interval field to months.
  3. Connect Scheduled Automation Trigger to Retrieve Attendance Sheet.

Tip: If your attendance data is updated late in the month, schedule this trigger for the first day of the next month to avoid partial data.

Step 2: Connect Google Sheets

These nodes retrieve attendance and salary data, append payroll results, and log email sends.

  1. Open Retrieve Attendance Sheet and set Document to [YOUR_ID] and Sheet to Emp list (gid=0).
  2. Keep Authentication set to serviceAccount and Combine Filters set to OR with Status filters for Present and Absent.
  3. Open Retrieve Salary Sheet and set Document to [YOUR_ID] and Sheet to Emp Salary (gid=1839371816).
  4. Configure Append Payroll Report with Operation set to append, Sheet to Employee Monthly Report (gid=735600063), and keep Use Append enabled.
  5. Configure Log Email Send with Operation set to append and Sheet to Email Send Log (gid=1224577084).
  6. Credential Required: Connect your googleApi credentials in Retrieve Attendance Sheet, Retrieve Salary Sheet, Append Payroll Report, and Log Email Send.

⚠️ Common Pitfall: Make sure the column headers in your Google Sheets match the expected fields (e.g., EmpId, Name, Salary, Status), or the merge and calculations will fail.

Step 3: Set Up Attendance Processing and Salary Merge

This stage calculates hours, runs a parallel branch to retrieve salaries, and combines datasets before calculating final salary deductions.

  1. Open Compute Daily Hours and keep the JavaScript as provided to calculate totals, missing hours, and attendance status.
  2. Ensure Compute Daily Hours outputs to both Retrieve Salary Sheet and Combine Salary Data in parallel.
  3. Open Combine Salary Data and set Mode to combine and Fields to Match to EmpId.
  4. Open Compute Salary Adjustment and keep the provided JavaScript that calculates Deduction and FinalSalary.

Tip: Because Compute Daily Hours branches in parallel, make sure both downstream nodes receive the correct items or the merge will be incomplete.

Step 4: Configure AI Summary Generation

This step uses an AI model to create a professional summary per employee and then formats it for email sending.

  1. In Produce AI Summary, set Text to =Employee ID : {{ $json.EmpId }} Name : {{ $json.Name }} Original Salary :{{ $json.OriginalSalary }} Total Missing Hours:{{ $json.TotalMissingHours }} Total Absent Days {{ $json.TotalAbsentDays }} Deduction: {{ $json.Deduction }} Final Salary: {{ $json.FinalSalary }} EmpEmail: {{ $json.EmpEmail }}.
  2. In Produce AI Summary, set System Message to the provided HR assistant prompt so it returns an array of objects with SummaryText.
  3. Open OpenAI Chat Engine and set Model to gpt-4.1-mini.
  4. Credential Required: Connect your openAiApi credentials in OpenAI Chat Engine.
  5. Open Format Summary JSON and keep the provided JavaScript to parse the model output into individual employee objects.

Tip: OpenAI Chat Engine is connected as the language model for Produce AI Summary—ensure the credentials are added to OpenAI Chat Engine, not the agent node.

Step 5: Configure Email Output and Logging

Send the AI-generated summary email and record the result in a Google Sheet.

  1. Open Dispatch Salary Email and set Text to ={{ $json.SummaryText }}.
  2. Set Subject to ={{ $json.EmpEmail }} and To Email to =Monthly Salary Summary – {{ $json.Name }} (Emp ID: {{ $json.EmpId }}).
  3. Set From Email to [YOUR_EMAIL] and keep Email Format as text.
  4. Credential Required: Connect your smtp credentials in Dispatch Salary Email.
  5. Connect Dispatch Salary Email to Log Email Send to append delivery results.

⚠️ Common Pitfall: The Subject and To Email fields appear swapped in typical email usage; verify your intended mapping before going live.

Step 6: Test and Activate Your Workflow

Run a manual test to confirm data flow, AI summaries, and email delivery before activating the monthly schedule.

  1. Click Execute Workflow to run a manual test from Scheduled Automation Trigger.
  2. Confirm Retrieve Attendance Sheet and Retrieve Salary Sheet return data, and that Combine Salary Data matches on EmpId.
  3. Verify Append Payroll Report added rows to the Employee Monthly Report sheet.
  4. Check that Dispatch Salary Email sends messages and Log Email Send writes results to Email Send Log.
  5. Once validated, toggle the workflow to Active so it runs monthly.
🔒

Unlock Full Step-by-Step Guide

Get the complete implementation guide + downloadable template

Common Gotchas

  • Google Sheets credentials can expire or need specific permissions. If things break, check the n8n Credentials screen and the connected Google account’s access to the exact spreadsheets first.
  • If your attendance sheet has inconsistent date formats or missing InTime/OutTime values, the “Compute Daily Hours” logic can miscount hours. Clean the sheet or add a fallback rule before month-end close.
  • OpenAI summaries can sound generic if you leave the default prompt untouched. Add your tone and required details early (policy wording, who to contact, how disputes work) or you’ll be editing outputs forever.

Frequently Asked Questions

How long does it take to set up this payroll email automation?

About 45 minutes if your Google Sheets are already structured.

Do I need coding skills to automate payroll emails?

No, not for the setup basics. You may want light edits in the calculation nodes if your deduction rules are unique.

Is n8n free to use for this payroll email automation workflow?

Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in OpenAI API costs (usually a few dollars a month for small teams).

Where can I host n8n to run this automation?

Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.

Can I customize this payroll email automation workflow for different deduction rules?

Yes. You can adjust the “Compute Daily Hours” and “Compute Salary Adjustment” code nodes to match your policy, then tweak the AI Agent prompt to reflect your wording. Common customizations include rounding rules for late arrivals, different absent-day penalties, and excluding certain statuses (like approved leave) from deductions.

Why is my Gmail connection failing in this workflow?

Usually it’s expired OAuth permission or the wrong sender account selected in n8n. Reconnect the Gmail credential, confirm the correct Google Workspace user has access, and double-check that the “Dispatch Salary Email” node is pointing at that credential. If you’re sending a lot at once, Gmail can also throttle briefly, so spacing sends or batching by department helps.

How many employees can this payroll email automation handle?

Dozens to hundreds, assuming your Google Sheet is clean and your n8n instance has enough memory.

Is this payroll email automation better than using Zapier or Make?

Often, yes, because payroll logic is messy in real life. n8n handles multi-step calculations, merging datasets by EmpId, and writing an audit trail back to Google Sheets without forcing you into expensive “task” pricing for every row. It also plays nicely with AI Agent + GPT-4, which is where your email summaries get that professional polish. Zapier or Make can still work if you only need a simple “new row → send email” flow. If you want a sanity check for your setup, Talk to an automation expert.

Once this is running, payroll emails stop being a monthly fire drill. The workflow handles the repetitive checks and formatting so you can focus on exceptions, not copy-paste.

Need Help Setting This Up?

Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.

Lisa Granqvist

Workflow Automation Expert

Expert in workflow automation and no-code tools.

×

Use template

Get instant access to this n8n workflow Json file

💬
Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Launch login modal Launch register modal