Introduction
Payroll is the most important recurring task in any business — and the most stressful if you forget. Automated payroll reminders ensure salaries are calculated, approved, and paid on time, every time.
This post builds a simple payroll reminder system for small teams (1-10 people).
The payroll cycle
Month end → Calculate salaries → Send for approval → Process payment → Send payslips → Confirm payment
Step 1: Set up the payroll sheet
Create a Google Sheet with these tabs:
Tab 1: Team
| A: Name | B: Role | C: Monthly Salary | D: Bank Account | E: UPI | F: PAN | G: Active? |
|---|---|---|---|---|---|---|
| Alice | Developer | 50000 | 1234567890 | alice@upi | ABCDE1234F | Yes |
| Bob | Designer | 40000 | 0987654321 | bob@upi | FGHIJ5678K | Yes |
Tab 2: Payroll Log
| A: Month | B: Name | C: Base Salary | D: Deductions | E: Bonus | F: Net Pay | G: Status | H: Paid Date | I: Payslip Sent |
|---|---|---|---|---|---|---|---|---|
| 2026-03 | Alice | 50000 | 5000 | 0 | 45000 | Paid | 2026-03-01 | Yes |
| 2026-03 | Bob | 40000 | 4000 | 2000 | 38000 | Paid | 2026-03-01 | Yes |
Tab 3: Settings
| A: Setting | B: Value |
|---|---|
| Payroll Day | 1st of month |
| Reminder Days Before | 3 |
| Late Fee % | 0 |
| Company Name | Your Company |
Step 2: Calculate salaries (Python)
import gspread
from google.oauth2.service_account import Credentials
from datetime import datetime
creds = Credentials.from_service_account_file("service_account.json",
scopes=["https://www.googleapis.com/auth/spreadsheets"])
gc = gspread.authorize(creds)
sheet = gc.open("Payroll")
def calculate_payroll(month):
"""Calculate payroll for all active team members."""
team = sheet.worksheet("Team").get_all_records()
payroll = sheet.worksheet("Payroll")
for member in team:
if member["Active?"] != "Yes":
continue
base = member["Monthly Salary"]
deductions = base * 0.1 # 10% for PF/tax (adjust as needed)
bonus = 0 # Add bonus logic here
net = base - deductions + bonus
# Add to payroll log
payroll.append_row([
month,
member["Name"],
base,
deductions,
bonus,
net,
"Pending",
"", # Paid date
"No", # Payslip sent
])
print(f"Calculated: {member['Name']} — Net: Rs. {net:,.0f}")
# Run on the 25th of each month
calculate_payroll("2026-04")
Step 3: Send reminders (email)
import resend, os
resend.api_key = os.environ["RESEND_API_KEY"]
def send_payroll_reminder(member, net_pay, month):
"""Send payroll reminder to team member."""
resend.Emails.send({
"from": "Payroll <[email protected]>",
"to": [member["email"]],
"subject": f"Payroll reminder — {month}",
"html": f"""
<p>Hi {member['name']},</p>
<p>Your salary for {month} has been processed.</p>
<p><strong>Net pay:</strong> Rs. {net_pay:,.0f}</p>
<p><strong>Payment date:</strong> 1st of next month</p>
<p>If you have any questions, please reach out.</p>
<p>Best,<br>HR Team</p>
""",
})
def send_owner_reminder(payroll_summary):
"""Send summary to business owner."""
resend.Emails.send({
"from": "Payroll System <[email protected]>",
"to": ["[email protected]"],
"subject": f"Payroll due: {payroll_summary['month']}",
"html": f"""
<h3>Payroll Summary — {payroll_summary['month']}</h3>
<p>Total payroll: Rs. {payroll_summary['total']:,.0f}</p>
<p>Team members: {payroll_summary['count']}</p>
<p>Payment due: {payroll_summary['due_date']}</p>
<p>Please process payments by the due date.</p>
""",
})
Step 4: Automate with cron
# Calculate payroll on 25th of each month
0 9 25 * * cd /path/to/project && python calculate_payroll.py
# Send reminders on 28th
0 9 28 * * cd /path/to/project && python send_payroll_reminders.py
# Send owner summary on 28th
0 9 28 * * cd /path/to/project && python send_owner_summary.py
Step 5: Generate payslips (PDF)
from fpdf import FPDF
def generate_payslip(member, month, base, deductions, bonus, net):
pdf = FPDF()
pdf.add_page()
pdf.set_font("Arial", "B", 14)
pdf.cell(0, 10, "PAYSLIP", ln=True, align="C")
pdf.set_font("Arial", "", 11)
pdf.cell(0, 7, f"Employee: {member['name']}", ln=True)
pdf.cell(0, 7, f"Role: {member['role']}", ln=True)
pdf.cell(0, 7, f"Month: {month}", ln=True)
pdf.ln(5)
pdf.set_font("Arial", "B", 11)
pdf.cell(0, 7, "Earnings", ln=True)
pdf.set_font("Arial", "", 11)
pdf.cell(100, 7, "Base Salary")
pdf.cell(0, 7, f"Rs. {base:,.0f}", ln=True)
pdf.cell(100, 7, "Bonus")
pdf.cell(0, 7, f"Rs. {bonus:,.0f}", ln=True)
pdf.set_font("Arial", "B", 11)
pdf.cell(0, 7, "Deductions", ln=True)
pdf.set_font("Arial", "", 11)
pdf.cell(100, 7, "PF + Tax (10%)")
pdf.cell(0, 7, f"Rs. {deductions:,.0f}", ln=True)
pdf.set_font("Arial", "B", 11)
pdf.cell(100, 7, "Net Pay")
pdf.cell(0, 7, f"Rs. {net:,.0f}", ln=True)
pdf.ln(5)
pdf.set_font("Arial", "I", 9)
pdf.cell(0, 6, "This is a computer-generated payslip.", ln=True)
filename = f"payslip_{member['name']}_{month}.pdf"
pdf.output(filename)
return filename
Step 6: WhatsApp reminders
import requests, os
def send_payroll_whatsapp(phone, name, net_pay, month):
url = "https://live-server-XXXX.wati.io/api/v1/sendSessionMessage"
message = f"Hi {name}, your salary for {month} has been processed. Net pay: Rs. {net_pay:,.0f}. Payment will be credited by the 1st. Questions? Reply here."
payload = {"whatsappNumber": phone, "messageText": message}
headers = {"Authorization": f"Bearer {os.environ['WATI_API_KEY']}"}
requests.post(url, json=payload, headers=headers)
Common mistakes
- No reminders — forgetting payroll is a disaster. Automate it.
- Manual calculation — Excel formulas can have errors. Use Python for accuracy.
- No payslips — employees need payslips for tax filing. Generate them automatically.
- No backup — store payroll data in Google Sheets (cloud backup) + local CSV.
- Ignoring deductions — PF, tax, and other deductions must be calculated correctly.
- No approval step — always have the owner review payroll before payment.
Key Concepts
- Payroll cycle = calculate → approve → pay → payslip → confirm
- Cron job = scheduled task that runs automatically
- Payslip = document showing earnings and deductions
- Deductions = PF, tax, and other withholdings
- Net pay = base salary - deductions + bonus
What to Try Next
- Track freelance income and expenses for finances
- Automate invoices for client billing
- Build a payroll dashboard in Streamlit
- Write SOPs for payroll processes
FAQ
Should I use payroll software or a custom script?
For 1-5 employees: custom script + Google Sheets is fine. For 5-20: use software (Razorpay Payroll, Zoho Payroll, or GreytHR). For 20+: use a dedicated HR/payroll platform. Start simple; upgrade when you outgrow it.
How do I handle variable pay (commissions, overtime)?
Add columns for “Overtime Hours,” “Commission,” and “Bonus” in the payroll sheet. Calculate: Net = Base + Bonus + Overtime - Deductions. Update the script to include these fields.
What about tax compliance (TDS, PF, ESI)?
For freelancers/contractors: deduct 10% TDS (Section 194J). For employees: deduct PF (12% of basic), ESI (0.75% if salary < ₹21,000), and professional tax. Consult a CA for exact compliance. The script handles basic calculations; use payroll software for complex compliance. See Track Freelance Income and Expenses.