Library / Reports, Analytics & Dashboards
Reports, Analytics & Dashboards
Generate Monthly Financial Reports with Gemini, SQL and Outlook
On the monthly schedule, it pulls cost center figures from MySQL, has Gemini write a year-to-date comparison, and emails the report through Outlook.
What it does
## Key Sections of n8n Workflow 🟢 Schedule Trigger - Triggers the automation on the 5th of every month. - Sets the cadence for monthly reporting. 📅 Date & Time + 🧮 PreviousMonth - Captures the current date and derives the previous month/year for dynamic filtering. - Used throughout all SQL queries for monthly slicing. 📊 Get Cost Centers with Budgets - Dynamically fetches all cost centers that have relevant budget and GL data for the selected period. - Ensures only active, relevant divisions are processed. 🔍 Filter - Narrows the analysis to a specific Cost Center (e.g., "AI DEPARTMENT") during testing or preview. 🔁 Loop Over Items - Iterates over all fetched Cost Centers to individually generate reports for each business unit. - Powers multi-division reporting automation. 🧾 YTD vs Previous Month1 - Performs detailed financial comparison between Year-To-Date and Previous Month. - Outputs revenue, expenses, and variance figures. 🏢 Departments + 🧱 verticalPL - Analyzes financial performance by sub-divisions (Verticals) within the cost center. - Data is transformed into an HTML table for final report. 🧱 Projects + 🧮 WIP1 - Gathers project status and WIP metrics. - Calculates % invoiced, cost % used, and revenue recognition stats. 👥 Employees + 📊 Employees1 - Counts total employees, joined this month/year for the selected cost center. - Used to calculate per-employee KPIs. 🔗 Merge + 🧾 Code - Combines all HTML tables into a single responsive report with visual formatting. - Clean, structured layout for email and review. 💡 Business Performance AI Agent (Analyst) - Uses Google Gemini 2.5 Pro to analyze financial HTML output. - Executes structured analysis and generates business insights, executive summary, profitability, and recommendations. 📩 Email Data + Microsoft Outlook - Sends the final HTML report via email. - Ready for business manager distribution with personalized message. ⏳ Wait - Enables looping and batch control across multiple cost centers. - Prevents overloading or email spamming. 🧠 Think + Calculator - Used by the AI Agent to "reason" and perform precise financial computations. - Ensures accuracy in gross/net profit, percentages, and insights.
The steps
- Schedule Trigger
- YTD vs Prevoius Month1
- Loop Over Items
- CostCentrs
- Date & Time
- PreviousMonth
- Selected Cost Center
- Get Cost Centers with Budgets
- Filter
- HTML
- verticalPL
- Merge
- Code
- Microsoft Outlook2
27 steps in total.
Similar automations