Use cases → Reporting and data
Reconciling calendar bookings with invoices using domain-wide delegation
Accurately match Google Calendar bookings to invoiced services across all users with domain-wide delegation, and avoid missing cancellations or updates that lead to financial errors.
| Who it is for | Finance operations engineers or automation teams responsible for billing reconciliation in Google Workspace environments. |
|---|---|
| APIs | Calendar API |
| Typical scopes | calendar |
The problem
Reconciling calendar bookings with invoiced services is critical in environments where bookings drive revenue or resource allocation. Relying on manual exports or single-user API access misses events across the wider tenant, especially when bookings are made on behalf of others or through shared calendars. Inaccurate reconciliation can result in overbilling, underbilling, or missed revenue, and manual checks do not scale.
How it works
- Provision a service account with domain-wide delegation and grant it the 'calendar' scope for all users.
- Use the Calendar API’s 'events.list' endpoint with 'showDeleted=true' and 'singleEvents=true' to obtain all events within the billing period, across all relevant calendars.
- Implement incremental sync by storing and supplying the 'syncToken' parameter from previous runs, letting you fetch only changes (including deletions and updates) since the last reconciliation.
- Track each event by its unique event ID, and record its status (confirmed, cancelled) and last modification timestamp.
- Compare this canonical calendar event list to your invoicing system, flagging discrepancies where event IDs are missing, cancelled, or modified after invoices were raised, and generate a detailed report for review.
What changes
You achieve reliable, tenant-wide matching of bookings to invoices, catching late cancellations or modifications that would otherwise be missed. This reduces financial errors and supports accurate client billing or resource allocation.
Watch it explained
“Create Google API Key (2024) || Google Cloud Platform *NEW*” — Code & Code on YouTube. Third-party video, included because it covers this ground well. We are not affiliated with the channel.
Questions people ask
Can I use a single syncToken for all calendars?
No, each calendar resource requires its own syncToken. You must persist and manage syncTokens per calendar when operating at scale via domain-wide delegation.
What happens if a syncToken expires or is lost?
If a syncToken is lost or becomes invalid (e.g., after too many missed changes), you must perform a full sync by querying all events without a syncToken and then storing the new one for future incremental updates.
How do I detect if an event was cancelled versus deleted?
The Calendar API marks cancelled events with status 'cancelled' and retains their event IDs if you use 'showDeleted=true'. True deletions without trace are rare but possible if the organiser purges the event; always check both status and existence.
Want this built?
This is a pattern we run in production. We will set up the delegation and build this on top of it — $500 per hour, most of it working the same day.
Talk to us Or read the setup guideRelated use cases
Send a daily digest that catches problems early
One scheduled email that checks the things that fail quietly and reports only what changed.
Run automation from a spreadsheet non-engineers can edit
Keep rules, templates and routing in a Sheet so the operations team changes behaviour without a deploy.
Reconcile records between two systems automatically
Compare what your tracking sheet says against what the source system says, and report the differences.