Enterprise Workflow Automation (NDA)
Self-hosted n8n platform orchestrating an on-premises ERP, a CRM, MS Graph, and SharePoint: daily invoice Excel generation with formula preservation, and training form processing with automated certificate distribution.
Built for a European professional-training company under NDA. The client name, live URLs, and workflow internals are omitted; the preview image is intentionally blurred.
Overview
A self-hosted n8n automation platform that replaced two of the client's most painful manual back-office processes: assembling a daily invoice reconciliation Excel from two disconnected systems, and processing training registration forms through to certificate delivery. It has been running in production for over 18 months.
The Challenge
The finance team spent hours every morning cross-referencing invoices from an on-premises ERP with account data in a CRM, then hand-maintaining a 30-column Excel file with fragile formulas. Separately, the training team manually collected registration forms, tracked participants, and emailed certificates one by one.
Neither system had a modern API surface: the ERP exposes a custom-key REST API, the CRM uses HTTP Basic Auth, and the canonical Excel lives in SharePoint where colleagues also edit it by hand.
Solution Architecture
Daily Invoice Reconciliation
A scheduled workflow (weekdays, 8:00 AM Budapest time) that:
Key Features
- Pulls fresh invoices from the ERP and account data from the CRM
- Joins them against a 225-entry cost-center map in PostgreSQL
- Rewrites the SharePoint Excel via MS Graph while preserving hand-authored formulas and partner cost-split columns
- Logs every run to PostgreSQL for auditability
- Recovers from concurrent human edits using SharePoint version history via Graph API
Training Forms and Certificates
Webhook-driven workflows receive registration form submissions, validate and store participants, then generate and email completion certificates automatically — turning a multi-day manual chore into minutes.
Excel Formula Preservation
The trickiest engineering problem: colleagues keep editing the same workbook, and Excel Table ranges inflate silently (thousands of phantom rows). The solution uses Python + openpyxl inside n8n code nodes with a backwards-row-search strategy that finds the true data boundary and rewrites only the data region, leaving formulas and formatting untouched.
Infrastructure
Dockerized n8n (app + runner + PostgreSQL + Nginx) self-hosted on Hetzner, with tenant-authenticated OAuth 2.0 against MS Graph for SharePoint and mailbox access. A documented multi-stage recovery protocol covers version-history rollback and backup restore.
Lessons Learned
- Shared Excel files are a hostile environment — always locate data boundaries defensively; never trust the declared table range.
- Log every automated run — the PostgreSQL run journal turned "the numbers look wrong" conversations into two-minute lookups.
- Design for human co-editing — automation that overwrites colleagues' work gets switched off; version-aware writes kept trust high.