N8N · AI AUTOMATION

An automated weekly KPI report in n8n that never invents a number

Nineteen nodes, four stages and no human steps. How the reporting workflow splits the work so the model never owns a number.

A node-by-node walkthrough of the weekly KPI reporting workflow, narrated over the n8n canvas.

  • 50 sec
  • English captions
  • Full transcript below

In short

Every Monday at 08:00 the workflow computes the ISO report week, checks whether that week has already been sent, loads last week's KPIs from a Google Sheet or an n8n data table, computes every figure in code, has Claude write the narrative around those figures, re-checks every number the model wrote against the real data, renders a branded HTML scorecard, emails leadership and logs the week.

Platform
n8n
Nodes
19
Stages
4
Human steps
0
Schedule
Mondays, 08:00
AI step
Claude Sonnet, narrative only

THE SHORT VERSION

What this
walkthrough shows.

The four stages

  1. 1
    Schedule, settings & dedupe

    A Monday 08:00 schedule starts the run. Configuration is read, the ISO report week is computed, and the workflow stops early if that week has already been reported.

  2. 2
    Load KPI data

    A condition picks the source — a Google Sheet or n8n's built-in Data Table — and the KPI rows for the reporting week are read into the same shape either way.

  3. 3
    Analyse & narrate

    Code computes deltas, percent of target and a red/amber/green status. Claude Sonnet writes the executive narrative against a narrative schema, with a rule-based fallback if the model path fails, and an owner alert if KPI data is missing.

  4. 4
    Guard, deliver & log

    A guard checks the numbers in the written narrative, the branded HTML email is rendered and sent to leadership, the report week is logged for de-duplication, and the owner is alerted if the fallback narrative was used.

The division of labour: code owns the numbers, the model owns the sentences

Most hesitation about AI-written reporting comes down to one question: what happens when the model gets a number wrong in an email that leadership reads before anyone else does?

This workflow answers it structurally rather than with a carefully worded prompt. Code computes every figure in the report — week-over-week change, percent of target, and a red, amber or green status. Claude is handed those computed figures and asked only to write the words around them. The model is never the source of a number.

Then the output is checked again. Every figure the AI wrote is compared against the real data before the email goes anywhere. A prompt can ask a model to be careful; a guard decides whether the message is allowed to send.

Stage 1 — The schedule and the de-duplication key

The run starts every Monday at 08:00. Before anything else happens, the workflow computes the ISO report week and checks whether that week has already gone out.

This is what makes re-runs safe. Scheduled workflows get re-run constantly in practice — after a credential is refreshed, after a node is edited, after someone clicks Execute to check a change. Without a de-duplication key, every one of those clicks is a second report landing in a leadership inbox. With one, the run simply stops.

The ISO week is a good key because it is unambiguous across year boundaries and does not depend on the day the run happens to fire.

Stage 2 — Two sources, one shape

KPIs live where the team already keeps them. A condition checks whether the source is a Google Sheet, and the matching branch reads the rows — either from the sheet or from n8n's built-in Data Table.

Both branches produce the same shape, so everything downstream is written once. Supporting the tool a team already uses is usually cheaper than migrating them to a new one for the sake of a report.

Stage 3 — Deltas, targets, status, then narrative

A code node computes the analysis: the change against last week, the percent of target, and the red, amber or green status for each metric. Those are deterministic calculations, and they belong in code where they can be read, tested and corrected.

A condition then checks whether KPI data was actually found. If it was not, the owner is alerted rather than a report being produced around empty values — a report that silently shows zeros is worse than no report at all.

With the figures settled, Claude Sonnet writes the executive narrative against a narrative schema, so the response comes back in a known structure rather than as free prose. If that path fails, a fallback narrative with no AI involved takes over, built from the same computed numbers using rules.

  • Week-over-week changeMovement against the previous reporting week.
  • Percent of targetWhere each metric sits against the number the business set.
  • Red, amber or green statusA status per metric, so the scorecard is scannable before anybody reads a sentence. In this workflow RAG means the traffic-light status, not retrieval-augmented generation.

Stage 4 — Guard, deliver and log

The final stage is where the report becomes an email. A guard node re-checks the figures that appear in the written narrative against the computed data, and the branded HTML scorecard is rendered.

The report is emailed to leadership, and the report week is written to the log that stage one reads — closing the loop that keeps a re-run from sending twice.

One more branch matters: if the fallback narrative was used, the owner gets an alert. The report still goes out on time, but nobody is left believing the AI path is healthy when it is not. Silent degradation is how automations stop being trusted.

Why "no invented numbers" is an architecture decision

It is tempting to solve accuracy with instructions — telling the model to only use supplied figures, to never estimate, to double-check its arithmetic. Instructions help. They are not a control.

A control is a step that can stop the message. In this workflow there are three: the data-found check before analysis, the number guard before sending, and the week log before anything is emailed at all. Each one has the authority to halt or reroute the run.

The model sits inside that frame doing the thing it is genuinely good at: turning a set of settled figures into a paragraph an executive will actually read on a Monday morning.

What you need to run it weekly

The moving parts are small, and most of them are decisions rather than code:

  • A KPI source with targetsA sheet or data table where each metric has a value and the target it is measured against.
  • An agreed metric setThe handful of numbers leadership actually acts on. The report is only as useful as that list.
  • A recipient list and a send windowWho receives it, and the day and hour it should land.
  • An owner for the alertsSomebody who is told when data is missing or when the fallback narrative was used.
  • Credentials for mail and the modelPlus a first supervised run before the schedule is left to itself.

Walkthrough transcript

Full narration from the walkthrough above. Captions are available in the player.

  1. 0:00

    Every Monday at 8 a.m., this n8n workflow writes the leadership KPI report by itself.

  2. 0:06

    First, it computes the ISO report week and checks whether that week already went out.

  3. 0:11

    Reruns are safe.

  4. 0:13

    Then it loads last week's KPIs from a Google Sheet or n8n's built-in data table.

  5. 0:19

    Here's the part that matters.

  6. 0:21

    Code computes every number, week-over-week change, percent of target, and a red, amber, or green status.

  7. 0:28

    Claude only writes the words around them.

  8. 0:31

    If the AI fails, a rule-based summary takes over.

  9. 0:34

    Then it checks every figure the AI wrote against the real data,

  10. 0:38

    renders the branded scorecard, emails leadership, and logs the week.

  11. 0:43

    No invented numbers. No duplicate sends.

  12. 0:46

    Just the report. Every Monday.

COMMON QUESTIONS

Questions people ask
about this workflow.

Can the AI get a number wrong in the report?

The model is not the source of any figure. Code computes week-over-week change, percent of target and the status for each metric, the model writes the narrative around those figures, and a guard re-checks every number that appears in the narrative against the real data before the email is sent.

What happens if the AI call fails?

A rule-based summary built from the same computed numbers takes over, so the report still goes out on schedule. The owner is alerted that the fallback narrative was used.

What if the KPI data is missing?

A condition checks whether KPI data was found. If it was not, the owner is alerted instead of a report being generated around empty values.

Will re-running the workflow email leadership twice?

No. The ISO report week is logged after a successful send, and each run checks that log before doing any work. If the week has already been reported, the run stops.

Where does the KPI data have to live?

Either a Google Sheet or n8n's built-in Data Table. A condition selects the source and both branches produce the same shape for the steps that follow.

Does RAG mean retrieval-augmented generation here?

No. In this workflow RAG is the red/amber/green traffic-light status computed for each metric against its target.

Can the report go somewhere other than email?

The delivery step is one node at the end of the workflow. Sending the rendered scorecard to a chat channel or writing it to a document is a change at that point, not a redesign of the stages before it.

Build status

This article describes a reviewed workflow implementation and the structure shown in the walkthrough. The metric set, targets, recipients and credentials are configured per business, and a supervised first run is part of putting it into service. No measured savings or reporting accuracy rates are claimed.

HAVE A PROCESS LIKE THIS?

Let’s build one
around your business.

Discuss your project
NEXT WALKTHROUGHn8n invoice capture: an AI workflow that reads every invoice in the inbox