← Selected work

Lead SyncSheet

A spreadsheet that turns Calendly bookings into Square customers automatically, so new leads reach the customer list without anyone retyping them.

Built for a business client. It runs inside the client's own spreadsheet.

In short

Problem
Bookings arrived in one tool while the customer list lived in another, so contacts had to be copied across by hand.
Approach
Use a spreadsheet as the middle step: bookings land there first, where staff can see them, then sync on a schedule.
Solution
Lead SyncSheet, a spreadsheet with a built-in menu that connects the two tools and syncs every five minutes.

At a glance

minutes between automatic syncs
5
sheets that act as the database tables
6
sync states a booking moves through
4
servers to host, because it runs inside the spreadsheet
0

The problem

The business took appointments through Calendly and kept its customer list in Square. Every new booking meant someone copying the name and email from one into the other, and checking that the person was not already there.

The fix had to run without adding another server or service to maintain.

The solution

Lead SyncSheet is a Google Sheet with a script attached. Staff set it up from a menu inside the sheet: they sign in to Calendly, choose which kinds of appointment to track, and the script subscribes to those bookings and publishes the web address that receives them.

Each new booking is checked, tidied and stored as a row. Every five minutes, the rows that have not been sent yet are compared with the customers already in Square, by email. New people are created, people whose details changed are updated, and the result is written back to the row.

Demo

Calendly's booking page beside Square's customer directory, before the booking is made.
A test booking in Calendly (left) arrives in Square as a new customer (right). Every record shown is test data.
The Lead SyncSheet control sheet: the sync switch turned on, the Calendly, Square and Apps Script services each reporting OK with their last run, and the table mapping Calendly invitee fields to Square customer fields.
The sheet in between: one switch turns the sync on or off, each service reports its last run, and staff choose which Calendly field fills which Square field.

Key features

  • Set up from inside the sheet

    A menu installs the schedule, walks through authorisation and event selection, creates the Calendly subscription and deploys the web address that receives bookings. The script manages its own deployments, including cleaning up old ones and resetting.

    Why it matters: the client connects the two tools without a developer, and can reconnect them if a link breaks.

  • No duplicate customers

    A repeated delivery of the same booking is ignored. When the same person books again, the older row is marked as replaced. Customers are matched by email, so the sync updates an existing Square customer instead of creating a second one.

    Why it matters: the customer list stays clean without anyone checking it.

  • Answered at once, processed after

    The web address replies to Calendly immediately and queues the booking for processing. Calendly's own questions and answers are flattened into columns, one per question.

    Why it matters: the booking tool gets its answer straight away, however long processing takes.

  • Mapping and pause switch in the sheet

    By default first name, last name and email carry across. The mapping is a range in the sheet that staff can change, and a toggle pauses the sync.

    Why it matters: small changes need an edit in the sheet, not a new version of the code.

  • Every outcome is visible

    Each booking row shows whether it is pending, synced, in error or replaced. Failures are also written to an errors sheet with the service, the action, the time and the message.

    Why it matters: when something fails, staff can see which booking and why, without opening the code.

Sheets as a database

Bookings, subscriptions, event types, customers, deployments and errors are all stored in sheets of the same spreadsheet. This was a deliberate choice, with a price.

Why it suited the client. They can open the spreadsheet and see every booking and its sync state, fix a value by hand, and change settings in a sheet. There is no database or server to host, and nothing else to log in to.

What it costs.

  • Each table is read into memory in full and searched row by row, so the cost of a lookup grows with the size of the sheet.
  • The table layer has no transactions or locks, so two overlapping runs could write over each other.
  • Syncing is scheduled, not instant: a booking reaches Square within about five minutes, plus the time it spends in the queue.

Under the hood

For technical readers: the data flow and the decisions behind it.

Data flow and technical decisions

Flow

Everything runs as one Apps Script project bound to the spreadsheet. Webhooks arrive at a web app deployed for anonymous access, and a time-driven trigger runs the sync.

Flow from a Calendly booking to Square. A webhook reaches the web app, which caches the request and replies 202. A one-off trigger then checks the token, screens duplicates and stores the row as pending in the sheet. Every five minutes the sync matches pending rows to Square customers by email, creates or updates them, and writes the outcome back. Flow from a Calendly booking to Square. A webhook reaches the web app, which caches the request and replies 202. A one-off trigger then checks the token, screens duplicates and stores the row as pending in the sheet. Every five minutes the sync matches pending rows to Square customers by email, creates or updates them, and writes the outcome back.
From booking to customer: receive, process, store and sync.
The stages from booking to customer, and what happens at each
Stage What happens Runs on
Subscribe Setup subscribes to invitee.created for the chosen event types, and stores a token per subscription. Menu action
Receive The web app caches the request, schedules a one-off trigger and returns 202. Webhook
Process Checks the token and that the event type belongs to an active subscription, normalises the payload, screens for duplicates, and stores the row as pending. One-off trigger
Sync When the toggle is on, matches pending rows to Square customers by email, then creates and updates them in bulk requests and writes the outcome back. Every 5 minutes

Decisions

  • Queue first, process later. The web app only stores the request and schedules work, which keeps the reply fast and keeps processing out of the request's execution limits.
  • A token on every request. The endpoint is open to anyone with the address, so each request must carry the token saved with a Calendly subscription before anything is stored.
  • Freshness decides duplicates. A delivery is dropped unless its update time is newer than the stored row and something actually changed. This applies both to the same booking and to other rows with the same email.
  • Reconcile with Square before writing. The sync lists the existing customers, keys them by email and reuses the server's id for a match, so the local sheet cannot drift into creating duplicates.
  • The script manages its own deployment. It uses the Apps Script API to create versions and deployments, and records the deployment details in a sheet, so a changed address can be repaired from the menu.

Yorsh is independent and is not affiliated with, endorsed by, or associated with Google, Calendly or Square.