How to Build a Weekly Automated Report and Email It

Generate a summary report from your data every week and deliver it to your team via email.

What This Integration Does

Weekly business reviews live or die on whether the numbers are in everyone's inbox by Monday morning. Hand-rolling the report each week is the kind of task that always slips - someone forgets, the query changes, the chart was on the wrong sheet. A Spojit scheduled workflow pulls fresh data every Monday at 8am, runs the same calculations and comparisons each time, formats the output cleanly, and emails it to the team without anyone having to remember.

The workflow has four moving parts: a schedule that fires on a fixed cadence, one or more queries against your data sources, a Transform that crunches and formats the numbers, and an email step that delivers it. The schedule keeps the cadence reliable, the queries pull fresh data each run, and per-step retries handle transient blips in your data source so the run doesn't fail just because the database had a hiccup.

Prerequisites

  • At least one data source connection - mysql, mongodb, shopify, netsuite, or any other connector that exposes the metrics you need.
  • An email path - the built-in Send Email node, resend send-email, or smtp send-email.
  • A list of recipients (a distribution list address works best so changes to membership don't require editing the workflow).
  • A clear sense of which metrics actually matter - revenue, orders, top products, new customers, churn. Pick 5 to 10; more than that gets ignored.

Step 1: Schedule the Trigger

Drop a Trigger node and set its type to Schedule. Pick a cadence with a buffer - Monday at 8am local time is the classic spot, but 7am gives you an hour to spot a bad run before anyone reads it. Use the date connector's list-timezones tool if you're unsure of the exact timezone identifier; configuring this wrong is the most common reason for off-by-one-day reports.

Step 2: Compute the Reporting Window

Add Connector nodes in Direct mode that build the date range for this run. The date connector's now, subtract, and format tools cover this cleanly: take now as weekEnd, then subtract 7 days from it for weekStart, formatting both as ISO timestamps. Compute the prior week's bounds too (subtract 14 days and 7 days from now) so the comparison metrics in step 4 have something to subtract from.

Step 3: Fetch the Data in Parallel

Wrap the data fetches in a Parallel node so independent queries run concurrently. Typical branches:

  • Orders - shopify list-orders filtered by created_at within the window, or netsuite list-sales-orders with a similar filter.
  • Revenue - mysql execute-query against your reporting database for SUM(total), grouped by day so you can do daily totals.
  • Customers - mongodb find-documents for new signups, or klaviyo list-events for engagement.

Run each query for both the current and prior windows so step 4 can compute deltas. If the data is large, project to just the columns you actually need to keep the merged state small.

Step 4: Calculate Metrics with Transform and Math

Run the arithmetic with the math connector in Direct mode: sum for totals, average for daily averages, and percentage for week-over-week deltas (feed the current value and the prior value as inputs). Then add a Transform node that combines those results plus the raw branch outputs into a single compact metrics object. A flat object like the one below is far easier to template into the email than juggling raw query results inline. Reference each upstream value with handlebars, for example {{ orders.count }} or {{ revenueDelta.result }}:

{
  "weekStart": "{{ weekStart }}",
  "totalOrders": "{{ orders.count }}",
  "orderDelta": "{{ orderDelta.result }}",
  "totalRevenue": "{{ totalRevenue.result }}",
  "revenueDelta": "{{ revenueDelta.result }}",
  "newCustomers": "{{ customers.count }}",
  "topProduct": "{{ topProducts.0.title }}"
}

Step 5: Format the Email Body

Use a second Transform node (or the text connector's join tool on a list of formatted lines) to build the HTML email body. Aim for a short subject line with the headline number (e.g. Weekly report: $128k revenue, +12% WoW) and a body with each metric on its own line, current value, and week-over-week change. Optionally pass the metrics through a Connector node in Agent mode with a prompt like Summarise this week's performance. Call out notable changes, flag concerns, suggest one action item. to turn the numbers into a narrative, and use a Response Schema if you want the summary returned as structured fields.

Step 6: Send the Email and Optionally Attach a CSV

End with a Send Email node (or resend send-email) to the team distribution list. If recipients want the raw data, generate a CSV with csv from-json from the orders or revenue list and attach it. For thresholds-as-alerts (revenue down more than 10%, orders below floor), add a Condition after the metrics step that pings slack send-message to a leadership channel in addition to the email.

Tips

  • Always include week-over-week comparisons - absolute numbers without context aren't actionable.
  • Use the date connector's format tool to render the report's date range in the subject line so threaded readers can see which week is which.
  • Keep the body short. Top 5 metrics plus a narrative summary beats a 30-row dump every time.
  • For finance reports, run a sanity check (a Condition node on revenue being non-negative and within an expected range) and skip the email if the numbers look obviously wrong rather than mailing out garbage.

Common Pitfalls

  • Timezone drift - if your schedule trigger and your database use different timezones, the window will include or exclude the wrong day. Force both to UTC (or the same business timezone) explicitly.
  • Late-arriving data - some systems backfill yesterday's records overnight. Run the schedule late enough that today's run isn't reading half-loaded data for the prior day.
  • Email rendering - if you're sending HTML, test in Gmail and Outlook before broad rollout. Mobile rendering breaks the most often.
  • Silent failures - if a data branch fails and you don't notice, you'll get a report with missing metrics. Add a check that every branch produced a non-null value and Slack the team if anything is empty.

Testing

Use the Run button to execute the workflow once on demand before you rely on the schedule, sending the email to just yourself. Inspect each step's output in the execution history - especially the metrics object and the rendered HTML body. Once you're happy with the format, send a real run to a small test group for a week, gather feedback on which metrics they actually use, then expand the distribution list and turn the schedule on.

Learn More

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.