Skip to main content

Automated monthly energy reports with PostgreSQL, PDF.co & email delivery

Workflow preview

Workflow preview
100%
Automated monthly energy reports with PostgreSQL, PDF.co & email delivery preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Monthly Energy Generation Report (PostgreSQL → PDF → Email) This workflow automatically collects monthly energy generation data from a PostgreSQL database, converts it into a structured PDF report ...

Best for

  • Document Extraction automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

n8n-nodes-base.code, n8n-nodes-base.httprequest, n8n-nodes-base.gmail, n8n-nodes-base.postgres, n8n-nodes-base.scheduletrigger, n8n-nodes-base.stickynote

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by WeblineIndia.

Original n8n.io source

1.1 Workflow description

Title
Automated monthly energy reports with PostgreSQL, PDF.co & email delivery
Workflow name
Automated monthly energy reports with PostgreSQL, PDF.co & email delivery

Monthly Energy Generation Report (PostgreSQL → PDF → Email)

This workflow automatically collects monthly energy generation data from a PostgreSQL database, converts it into a structured PDF report and emails it to stakeholders. It eliminates manual report creation and ensures timely delivery of performance summaries.

Who’s it for

  • Energy companies monitoring solar, wind or hydro generation
  • Operations & maintenance (O&M) teams needing monthly summaries
  • Managers and executives who require periodic performance reports
  • Data analysts who want automated reporting instead of manual exports

How it works

  1. Monthly Trigger → Schedules the workflow to run once a month.
  2. Postgres Node → Fetches energy data from the energy_data table.
  3. Code Node (Transform Data) → Structures the raw records into JSON with metadata (date_range, records, note).
  4. HTTP Request (PDF.co API) → Converts structured data into a formatted PDF report.
  5. Gmail Node (Send Report) → Sends the PDF report (or link) via email to the configured recipient.

How to set up

  1. Import the workflow JSON into n8n.

  2. Configure credentials:

    • PostgreSQL connection (DB host, user, password, database, schema).
    • Gmail OAuth2 credentials.
    • PDF.co API key (for HTML → PDF conversion).
  3. Update:

    • Database table (energy_data).
    • Email recipients in the Gmail node.
    • PDF template (if custom formatting is required).
  4. Activate workflow.

Requirements

  • n8n (self-hosted or cloud)
  • PostgreSQL database with energy generation data
  • PDF.co API account with valid API key
  • Gmail account with OAuth2 access
  • Internet access for API calls

How to customize

  • Change the SQL query in the Postgres node to filter specific plants or date ranges.
  • Update the Code node to add extra fields (e.g., average power, anomalies).
  • Modify the PDF.co request body to use a custom HTML template for branding.
  • Replace Gmail with Outlook, SMTP, or Slack for distribution.

Add-ons

  • Add Slack/Teams node to notify teams when reports are sent.
  • Store PDFs in Google Drive or S3 for archival.
  • Add a dashboard (e.g., Grafana or Superset) that references the same DB for real-time view.
  • Integrate with Jira to auto-create tasks for underperformance alerts.

Use Case Examples

  • Solar company emailing monthly reports to plant owners.
  • Wind farm operator generating regulatory compliance reports.
  • O&M teams automating KPI summaries for executives.
  • Consulting firms monitoring multiple clients’ energy production.

Common Troubleshooting

Issue Possible Cause Solution
Workflow does not trigger Cron not set correctly Verify Schedule Trigger node interval is monthly
No data returned from Postgres Wrong schema/table or DB creds Check DB connection and table name
PDF not generated Invalid/missing PDF.co API key Generate a new key in PDF.co dashboard
Email not sent Gmail OAuth expired or wrong recipient Reconnect Gmail credentials and confirm recipient email
PDF output malformed Incorrect JSON → HTML conversion Check Code node formatting and PDF.co request body

Need Help?

Our n8n workflow automation experts at WeblineIndia can help you:

  • Set up the PostgreSQL connection securely,
  • Customize the PDF layout with your company branding,
  • Add more delivery channels (Slack, Teams, S3),
  • Extend reporting logic (KPIs, charts, anomaly detection),
  • And so much more.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Transform data

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 2 - Convert data to pdf

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 3 - Send Report

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 4 - Get energy data

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.6

Block 5 - Monthly Trigger

Type / Role
n8n-nodes-base.scheduleTrigger - scheduleTrigger
Config choices
Version 1.2

Block 6 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 7 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Automated monthly energy reports with PostgreSQL, PDF.co & email delivery
Complexity intermediate
Nodes 7
Categories Document Extraction
Author WeblineIndia
Published 01 Sept 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/8113/8113.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Automated monthly energy reports with PostgreSQL, PDF.co & email delivery do?

Monthly Energy Generation Report (PostgreSQL → PDF → Email) This workflow automatically collects monthly energy generation data from a PostgreSQL database, converts it into a structured PDF report ...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Document Extraction use case.