πŸ”¬ Automated monthly energy reports with PostgreSQL, PDF.co & email delivery

⚑ 114 views Β· πŸ”¬ Document Extraction & Analysis

Description

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

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

How to customize

Add-ons

Use Case Examples

Common Troubleshooting

IssuePossible CauseSolution
Workflow does not triggerCron not set correctlyVerify Schedule Trigger node interval is monthly
No data returned from PostgresWrong schema/table or DB credsCheck DB connection and table name
PDF not generatedInvalid/missing PDF.co API keyGenerate a new key in PDF.co dashboard
Email not sentGmail OAuth expired or wrong recipientReconnect Gmail credentials and confirm recipient email
PDF output malformedIncorrect JSON β†’ HTML conversionCheck Code node formatting and PDF.co request body

Need Help?

Our n8n workflow automation experts at WeblineIndia can help you:

πŸ”— Nodes Used

HTTP Request, Postgres, Gmail, Schedule Trigger

πŸ“₯ Import

Download workflow.json and import into n8n: Workflow menu β†’ Import from File

πŸ“– Importing guide Β· πŸ”‘ Credential setup