# How do you automate a weekly report with n8n and an AI model?

Date: 2025-07-10 · Author: Robert Scales · https://guidetoartificialintelligence.com/en/learn/automate-weekly-report-n8n-ai-model/

**Answer:** Build a short chain of n8n nodes: a Schedule Trigger set to once a week, a step that fetches the week's data, an AI step that turns it into a summary, an approval email to you, and a final send to your readers. Add an error workflow and a check for empty data, so a bad week produces an alert instead of a wrong report.

A weekly report is a good first automation with AI because the shape never changes: the same data, the same questions, the same readers, every Monday. What changes is the content, and that is where a language model helps, turning a table of numbers or a list of tickets into a few readable paragraphs. n8n, a visual workflow tool that links apps through steps called **nodes**, can run the whole thing on a schedule.

The plan below has five stages: schedule, fetch, summarize, review and send. Each one is a node or two, and each one has a way to go wrong that you can plan for in advance.

## The workflow, step by step

The example is a volunteer-run food bank that logs donations and visits in a spreadsheet and wants a Monday summary for its board. The details are illustrative; swap in your own data source.

| # | Node | What to set |
|---|---|---|
| 1 | Schedule Trigger | Trigger Interval: Weeks; Weeks Between Triggers: 1; Weekday: Monday; Hour: 8am; Minute: 0 |
| 2 | Data node (for example Google Sheets) | Read last week's rows only |
| 3 | IF | Are there any rows? If not, go to 3b |
| 3b | Stop And Error | Message: "No data for last week" |
| 4 | AI model node (for example OpenAI, Message a Model) | Prompt below; stored credential |
| 5 | Gmail, Send and Wait for Approval | To: yourself; Message: the draft report |
| 6 | Gmail, Send | To: the board list, after approval |

**Step 1, schedule.** The Schedule Trigger runs a workflow at set times, much like cron, the classic Unix scheduler. The Weeks interval above means every Monday at 8:00. If you prefer a cron expression, the same schedule is:

```text
0 8 * * 1
```

That reads: minute 0, hour 8, any day of the month, any month, day of the week 1 (Monday). Check the time zone: the node uses the workflow's time zone if you set one in Workflow Settings, and otherwise the instance's. And remember that a scheduled workflow does nothing until you save it and switch it to active.

**Step 2, fetch.** Read only what the report needs, ideally already filtered to the past seven days. Smaller input means a cheaper, faster AI step and less room for the model to wander.

**Step 3, check.** Before spending anything on AI, make sure there is something to summarize. An IF node tests whether rows came back. If none did, the **Stop And Error** node fails the run on purpose, which sets off your error alert (more on that below) instead of producing a confident report about nothing.

**Step 4, summarize.** Give the model a tight brief:

```prompt
You write a weekly summary for the board of a volunteer food bank.
Using only the rows below, write:
1. Three bullet points with the week's totals (donations received, households served, volunteer hours).
2. One short paragraph on anything unusual compared with the averages given.
3. A line "Data gaps:" listing any missing or odd values. Write "none" if there are none.
Do not estimate or invent figures. Under 200 words.

Rows: {{ JSON.stringify($json) }}
```

The double curly braces are an n8n expression that inserts data from the previous step. Asking for a "Data gaps" line gives the model a sanctioned place to admit problems rather than smoothing over them. Keep your API key in n8n's credential store, never pasted into the prompt.

**Step 5, review.** The Gmail node's **Send and Wait for Approval** operation emails you the draft with an approval button and pauses the workflow until you respond. Choose **Approve and Disapprove** so that a bad draft can be stopped. Spot-check one total against the spreadsheet before you click.

**Step 6, send.** Only the approved path reaches the final Gmail **Send** node.

> **Try it:** Before activating the schedule, run the workflow by hand three times: once with normal data, once with an empty sheet, and once with a deliberately wrong number in one row. You should get a draft to approve, an error alert, and a draft whose "Data gaps" line or totals reveal the problem.

## How do you make sure it fails safely?

Decide in advance what "safe" means: when something breaks, nobody receives a wrong report, and you hear about it the same morning. Three n8n features cover most of this.

First, an **error workflow**. Create a separate workflow that starts with the **Error Trigger** node and sends you an email or chat alert. Then, in the report workflow's Settings, choose it under **Error workflow**. From then on, any failed run, including the deliberate one from Stop And Error, alerts you. One error workflow can watch all your automations.

Second, choose what each node does on failure. In a node's Settings tab, **On Error** can stop the workflow, continue, or continue through a separate error output that you route to an alert. For the AI and email steps, stopping is the safe default: a report that skips a failed step is worse than no report. Be cautious with **Retry On Fail** on those nodes, since each retry is another paid model call or another email, and avoid **Always Output Data** on IF nodes, which n8n warns can cause an endless loop.

Third, keep the schedule bounded and visible. A weekly interval runs about 52 times a year; a mistyped one such as every 5 minutes would run over 2,000 times a week. After activating, open the Executions list the following Monday to confirm exactly one run happened, and check your AI provider's usage page now and then. Together with the human approval step, this means the worst ordinary failure is a late report and an alert in your inbox, never a wrong one sent in your name.

## Sources

- Schedule Trigger node (n8n docs, commit a7dc52d): https://github.com/n8n-io/n8n-docs/blob/a7dc52d6e19aeb218df9fb8ff9f51d758e23d379/docs/integrations/builtin/core-nodes/n8n-nodes-base.scheduletrigger/index.md
- Error handling and node settings (n8n docs): https://github.com/n8n-io/n8n-docs/blob/a7dc52d6e19aeb218df9fb8ff9f51d758e23d379/docs/flow-logic/error-handling.md
- Gmail node message operations (n8n docs, commit a7dc52d): https://github.com/n8n-io/n8n-docs/blob/a7dc52d6e19aeb218df9fb8ff9f51d758e23d379/docs/integrations/builtin/app-nodes/n8n-nodes-base.gmail/message-operations.md
