Case Study
Automated Invoicing & Pay-Period Drafts
From scattered calendar and schedule data to a ready-to-send invoice draft for every instructor
Project Overview
Every pay period, this workflow does the invoicing prep that used to swallow most of a day. It gathers calendar events and schedule data, works out each instructor's hours, applies the right contract category, captures the supporting figures, and produces a tailored email draft per person — leaving only a quick review and send.
The Challenge
Problem: Invoicing data lived in three places — a calendar, a schedule sheet, and a booking platform with no API. Reconciling them by hand each period was slow and error-prone, and mistakes meant under- or over-paying staff.
How it works
A scheduled job reconciles three data sources — including a no-API platform reached via authenticated headless browser — into per-instructor drafts.
Technical Implementation
Multi-Source Data Merge
The workflow reads events from Google Calendar and reference data from Google Sheets (instructors and the season schedule), then merges and aggregates them into one consistent view of who worked when.
Period Logic & Categorisation
It calculates the correct pay-period dates, computes hours, and uses a switch to categorise each booking by contract type — so different rates and templates are applied automatically.
Zero-Hour Filtering
Instructors with no hours in the period are filtered out before anything is generated, so no empty or incorrect invoices are ever produced.
Authenticated Headless Capture
Because the source platform has no API, a Browserless headless browser signs in with session cookies to capture the supporting figures, which are compiled into a file and attached to each draft.
Key Features
- Runs automatically every pay period (scheduled)
- Reads all calendar events for the period
- Matches each event to the right instructor
- Calculates hours and categorises by contract type
- Skips anyone with zero hours
- Captures supporting figures from a no-API platform
- Generates a per-instructor Gmail draft, ready to send
Interested in similar automation?
Let's discuss how I can help automate your marketing workflows and analytics reporting.
Impact
Technologies Used
Business Value
- Faster, calmer monthly invoicing close
- Fewer payment errors and disputes
- A clear, auditable trail for every period
- Admin time returned to higher-value work