👥 Track employee attendance with analytics, email reports & Slack alerts using Google Sheets

⚡ 303 views · 👥 HR & Recruitment

Description

Transform your attendance management with this enterprise-grade automated workflow featuring AI-powered analytics, multi-dimensional insights, and intelligent alerting. Running hourly, it integrates multiple data sources (attendance logs + employee master data), performs sophisticated statistical analysis, detects anomalies, generates department-specific insights, and delivers beautiful HTML reports via email and Slack. Get real-time visibility into attendance patterns, punctuality trends, and actionable alerts for HR, management, and department heads. 📊🎯✨

Good to Know

How It Works

  1. Automated Trigger – Runs hourly to monitor attendance with zero manual effort.
  2. Dual Data Ingestion – Fetches attendance and employee master data, then merges them for enriched analytics.
  3. Advanced Analytics Engine – Analyzes attendance, calculates key metrics, detects anomalies, and generates alerts.
  4. Smart Conditional Routing – Validates data, prioritizes alerts, and routes notifications via email, Slack, and database.
  5. Rich Email Reports – Sends visually formatted reports with metrics, alerts, and detailed employee breakdowns.
  6. Slack Block Kit Integration – Delivers structured, real-time attendance alerts with visual indicators to team channels.
  7. Data Persistence & Logging – Logs daily summaries, maintains audit trails, and prepares data for trend analysis dashboards.

How to Use

Basic Setup

  1. Import the Workflow: Copy JSON → n8n → Import from File
  2. Configure Credentials: Add Google Sheets, SMTP, and Slack credentials
  3. Update Spreadsheet IDs: Replace all placeholder sheet IDs with your actual Google Sheet IDs
  4. Set Email Addresses: Update sender and recipient email addresses
  5. Configure Slack Channel: Replace channel ID with your team’s attendance channel
  6. Test: Execute workflow manually to verify connections
  7. Activate: Turn on the Schedule Trigger for hourly execution

Advanced Configuration

Requirements

Google Sheets Setup

Sheet 1: AttendanceLogs

ColumnTypeDescriptionExample
EmployeeIDTextUnique employee identifierEMP001
EmployeeNameTextFull nameJohn Doe
DateDateAttendance date (YYYY-MM-DD)2025-01-15
StatusTextPresent/Absent/Late/Leave/WFH/Half-DayPresent
CheckInTimeTimeArrival time (HH:MM)09:15
CheckOutTimeTimeDeparture time (HH:MM)18:00
NotesTextOptional commentsDoctor appointment

Sheet 2: Employees (Master Data)

ColumnTypeDescriptionExample
EmployeeIDTextUnique identifier (matches AttendanceLogs)EMP001
EmployeeNameTextFull nameJohn Doe
DepartmentTextDepartment nameEngineering
ManagerTextReporting manager nameJane Smith
ShiftTextDay/Night/EveningDay
EmailEmailWork email addressjohn.doe@company.com
ContractTypeTextFull-Time/Part-Time/ContractFull-Time

Sheet 3: DailySummary (Auto-populated by workflow)

ColumnTypeDescription
DateDateReport date
HourNumberHour of day (0-23)
PresentNumberPresent count
AbsentNumberAbsent count
LateNumberLate count
AttendanceRateNumberAttendance percentage

Credentials Needed

  1. Google Sheets OAuth2 API

    • Enable Google Sheets API in Google Cloud Console
    • Create service account credentials
    • Share all 3 sheets with service account email
  2. SMTP Email Account

    • Gmail: Enable “App Passwords” in Google Account settings
    • Or use company SMTP server details
    • Requires: Host, Port (587), Username, Password
  3. Slack Bot Token

    • Create Slack App at api.slack.com/apps
    • Enable permissions: chat:write, chat:write.public
    • Install app to workspace
    • Copy Bot User OAuth Token (starts with xoxb-)
    • Invite bot to target channel

Placeholder Values to Replace

PlaceholderWhere to FindExample
YOUR_ATTENDANCE_SPREADSHEET_IDGoogle Sheets URL1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms
YOUR_EMPLOYEE_SPREADSHEET_IDGoogle Sheets URL1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms
YOUR_SUMMARY_SPREADSHEET_IDGoogle Sheets URL1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms
C12345678Slack → Right-click channel → Copy link → Extract IDC05XXXXXXXX
hr@company.comYour HR emailhr@yourcompany.com
management@company.comManagement distribution listleadership@yourcompany.com

Customizing This Workflow

Modify Alert Thresholds

In the Analytics Engine node, find these lines:

const lateThreshold = metrics.totalEmployees * 0.1; // Change 0.1 to 0.15 for 15%
const absentThreshold = metrics.totalEmployees * 0.15; // Change to 0.20 for 20%

Add New Status Types

In the Analytics Engine node, add to the switch statement:

case 'Remote':
  statusCount.remote++;
  break;

Customize Email Template

In the Format Email node, modify the emailHtml variable:

Add SMS Notifications

  1. Add Twilio or Vonage node after “Critical Alerts”
  2. Send to on-call manager for high-severity alerts
  3. Use message: 🚨 ${data.absent} employees absent today. Review required.

Multi-Location Support

Modify Analytics Engine to group by Location field:

const locationMetrics = {};
todayRecords.forEach(record => {
  const location = employee.location;
  if (!locationMetrics[location]) {
    locationMetrics[location] = { present: 0, absent: 0, late: 0 };
  }
  // ... aggregate by location
});

Shift-Specific Analysis

Add logic to compare check-in times against shift schedules:

const shiftTimes = {
  'Day': '09:00',
  'Night': '21:00',
  'Evening': '14:00'
};
const expectedTime = shiftTimes[employee.shift];

Integration with HR Systems

Add HTTP Request node to push data to:

Advanced Analytics

Add Python or R nodes for:

Dashboard Integration

Export data to visualization platforms:

Troubleshooting

Common Issues

“Could not find node”

“No records found”

“Email not sending”

“Slack message failed”

Performance Optimization

Security Best Practices

Discover more workflows – Get in touch with us

đź”— Nodes Used

Send Email, Google Sheets, Slack, Schedule Trigger

📥 Import

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

📖 Importing guide · 🔑 Credential setup