To email SQL reports on a schedule with n8n, connect a Schedule Trigger to the database node for your SQL engine, run a query for the report’s date range and fields, optionally format the results, and pass them to an email node. Save and publish the workflow, check its timezone, then test the full delivery before relying on it.
How do I schedule a SQL query in n8n?
Build the workflow as a sequence of nodes. The exact database and email nodes depend on the systems your organization uses; the example below uses Postgres for the query and Gmail for delivery. n8n also documents a Microsoft SQL integration, and other providers may have their own nodes or SMTP setup.
- Add a Schedule Trigger. Choose an interval or a calendar schedule, such as a daily run at a specified time.
- Add the database node for your SQL engine. Configure its credentials and select the query operation. In the Postgres node, the operation is called Execute Query.
- Write a focused query. Return only the columns needed for the report and restrict results to the intended reporting period.
- Format the output if needed. Add a transformation or summary step only when it improves readability or handles a reporting requirement.
- Add an email node. Map the query output into the message, choose the recipient and subject, and select text or HTML where the provider supports both.
- Save and publish the workflow. A Schedule Trigger does not run as an active schedule until the workflow is published.
For example, a daily report might query the previous day’s transactions, format the rows into an HTML table, and send the message to a reporting mailbox. That is a design pattern, not a preset report: adapt the query, date boundaries, formatting, and recipients to your data and policies.
How should I choose the schedule and timezone?
The Schedule Trigger runs workflows at fixed intervals and times. It supports interval settings and custom cron expressions. n8n’s cron format can include seconds as an optional sixth field; use the syntax shown in the Schedule Trigger documentation when defining a custom expression.
Free tools Windows power users keep installed
One-click scans. No signup required.
#1 Best Overall
Check the timezone in the workflow settings rather than assuming a default. The trigger uses the workflow timezone when one is configured; otherwise it uses the instance timezone. n8n documents America/New_York as the default for self-hosted instances. n8n Cloud attempts to detect the owner’s timezone and falls back to GMT if it cannot. Daylight-saving changes can therefore affect the local clock time represented by a schedule.
Calendar rules also need deliberate boundaries: a monthly trigger set for day 30 does not run in February. If a report must run on the last calendar day of every month, verify that the chosen schedule expresses that rule rather than relying on a day-of-month setting that some months lack.
Rank #2
What happens if a scheduled run is missed?
Do not assume n8n will automatically replay a run after downtime. The Schedule Trigger documentation describes missed-execution choices: discard missed runs (the default), run the most recent missed run, or run the most recent missed run per rule. These options require Schedule Trigger nodes added in n8n 2.36 or later and an instance using the durable scheduler. The default in-memory scheduler does not run missed executions. See n8n’s scheduling and missed-execution details for the supported configuration.
Choose behavior based on the report’s purpose. A status snapshot may be useful only at its scheduled time, while a period-end report may need a recovery plan if the instance was unavailable. If catch-up is important, confirm both the node version and scheduler configuration in the deployment.
How do I query the database safely and accurately?
Use the database-specific node and parameterize dynamic values
Choose a node that supports your SQL system and the operation you need. For Postgres, n8n provides Execute Query and query parameters. When a value such as a date boundary comes from workflow data, pass it as a parameter rather than concatenating untrusted input into SQL text. n8n says it sanitizes Postgres query parameter values to prevent SQL injection. See the Postgres node documentation for its query and parameter options.
Limit the report to relevant data
Select only required columns and constrain the date range in the query. Decide explicitly what the workflow should do when the query returns no rows: send a brief no-data message, send an empty report, or skip delivery. This is a reporting choice to implement and test, not a universal n8n default.
Rank #4
Check large numbers before formatting
For Postgres output, n8n warns that NUMERIC and BIGINT values longer than 16 digits may be incorrect when emitted as standard numbers. Its documentation describes text output for large-format numbers. Check long identifiers and high-precision figures before converting or formatting them, especially if recipients may use them for reconciliation.
Keep database permissions narrow
If the report only reads data, use a read-only database credential where practical. n8n’s security audit includes database-related checks, including expressions in SQL Execute Query and Query Parameters fields and unused query parameter fields; it is a review aid, not a replacement for your organization’s access controls.
Recommended Free Tools
How can I email database query results automatically?
Configure the email step for the provider authorized in your environment. For Gmail, n8n’s documented Send operation takes a recipient, subject, and message; it supports text or HTML email, with optional attachments and CC/BCC settings. Gmail credentials must be configured. These are Gmail-node capabilities and should not be assumed to apply identically to another provider. See the Gmail node documentation.
For another email service, use its n8n node if available or configure SMTP as appropriate, following that provider’s credential and delivery requirements. For a short result, a readable text message may be enough. For tabular data, HTML can improve scanability; if recipients need a file, confirm that the selected provider and node support the attachment workflow you intend to use.
What should I test before activating the schedule?
Run the workflow manually against representative data before depending on scheduled delivery. Verify the parts that can fail independently:
- Confirm the query returns the intended reporting period, columns, and row count.
- Test an empty result and decide whether it should send a no-data message, an empty report, or no email.
- Check unusually large results and long numeric values for truncation, precision changes, or an unwieldy email.
- Inspect the rendered message in the recipient’s likely email client, especially if using HTML.
- Verify To, CC, and BCC recipients and confirm credentials work.
- Confirm the workflow is saved and published and that the configured timezone matches the intended send time.
Why didn’t my n8n scheduled workflow run?
Check the likely causes in this order:
- Publication state: confirm the workflow was saved and published, not just manually executed.
- Timezone: compare the workflow timezone with the instance timezone and the intended local time.
- Schedule rule: inspect the interval or cron expression. For calendar schedules, verify that the chosen date exists in every relevant month.
- Downtime and catch-up configuration: missed executions may be discarded by default; the documented catch-up choices depend on node version and the durable scheduler.
- Node and credential errors: inspect the execution for database query, authentication, or email delivery failures.
For deployment choices, n8n documents Cloud, npm, and self-hosting options. The workflow itself does not require self-hosting; select a deployment based on your operational and governance needs. See n8n’s hosting documentation.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
How can I review workflow security?
n8n’s security audit can be run from the CLI, public API, or an n8n node. Its report covers credentials, database, file-system, node, and instance categories. Use it to identify issues for review, including database query expressions and parameter fields, but do not treat a clean audit as a substitute for organizational security review. Details are in n8n’s security audit documentation.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

