This workflow automates the process of retrieving energy consumption data, formatting it into a CSV report, and distributing it every week via email and Google Drive.
Energy providers, sustainability departments, facility managers, renewable energy operators.
Workflow triggers every Monday at 8 AM, fetches consumption data, emails CSV report and saves a copy to Google Drive.
Type: HTTP Request Node
Makes a GET request to:
https://api.energidataservice.dk/dataset/ConsumptionDE35Hour (sample API)
The API returns JSON data with hourly electricity consumption in Denmark.
Sample Response Structure:
{
"records": [
{
"HourDK": "2025-08-25T01:00:00",
"MunicipalityNo": ___,
"MunicipalityName": "Copenhagen",
"ConsumptionkWh": 12345.67
}
]
}
Type: Code Node
Extracts the records array from the API response and maps each entry into separate JSON items for easier handling downstream.
Code used:
const itemlist = $input.first().json.records; return itemlist.map(r => ({ json: r }));
data.fromEmail: Sender email address (configure in node).toEmail: Recipient email address.subject: "Weekly Energy Consumption Report".attachments: =data (binary data from the previous node).Type: Google Drive Node
Uploads the CSV file to your Google Drive root folder.
Filename pattern:
energy_report_{{ $now.format('yyyy_MM_dd_HH_ii_ss') }}
Requires valid Google Drive OAuth2 credentials.
Change report frequency, email template, data format (CSV/Excel) or add-ons.
| Issue | Cause | Solution |
|---|---|---|
| Data not fetched | API endpoint incorrect | Verify URL |
| Email delivery issues | SMTP configuration incorrect | Verify SMTP |
| Drive save fails | Permissions/Drive ID incorrect | Check Drive permissions |
Contact WeblineIndia for additional customization and support, we're happy to help.


