Quick Overview
This workflow runs monthly to benchmark procurement KPI results stored in Google Sheets against external peer benchmarks, calculates gap and severity, uses Google Gemini to generate management-ready analysis, writes results back to Google Sheets, and emails leadership alerts and a consolidated monthly report via Gmail.
How it works
- Runs on a monthly schedule trigger.
- Loads benchmarking settings and fetches all procurement KPI rows marked Ready from Google Sheets.
- For each KPI, looks up the active KPI definition and active external benchmark in Google Sheets, and routes missing items to Review Required.
- Builds a comparison context, validates numeric inputs, and calculates the benchmark gap percentage, performance status, and severity.
- Sends the KPI context and calculated results to Google Gemini to generate a structured gap summary, likely causes, recommended actions, and a management comment.
- Appends the completed benchmark result to a Google Sheets results sheet and marks the source KPI row as Processed.
- Emails a leadership alert via Gmail when a KPI is below benchmark, and generates and emails an HTML monthly benchmark report summarizing all processed KPIs.
Setup
- Create and connect credentials for Google Sheets, Gmail, and Google Gemini (PaLM/AI Studio) in n8n.
- Update the Google Sheets document and sheet tabs so they match the workflow’s expected structure (Procurement_KPIs, KPI_Definitions, External_Benchmarks, and Benchmark_Results) and ensure KPI rows have a status column.
- Fill in recipient addresses (leadership_email and monthly_report_email) and adjust thresholds/status values in the workflow settings (near_benchmark_threshold_pct, warning/critical thresholds in KPI_Definitions, and active flags).
- Ensure KPI_Definitions and External_Benchmarks contain active rows for each kpi_code you expect to process, and set at least one KPI row to Ready for testing.