Services

Start a project
Google Forms and Calendar

Add Google Form bookings to your calendar automatically.

A simple booking form is often all a salon, tutor, repair shop or cleaner needs. But copying each request into the calendar by hand is where mistakes and double bookings creep in. This free script adds every booking to Google Calendar the moment it’s submitted, and warns you when a time is already taken.

How it works

The form saves each booking as a row in a Google Sheet. A short script in that sheet runs on every new submission. It reads the date and time, checks your calendar for anything already booked then, and either adds the event or marks the row as a clash and emails you. Each row gets a note in a Calendar column, so you can see what happened to every booking.

Step 1: Set up the form

Create a Google Form with these questions. The script looks for these exact names, so keep the wording, or change the names in the script to match:

  • Name (short answer)
  • Email (short answer, with Response validation → Text → Email turned on)
  • Service (dropdown, for example Haircut, Color, Consultation)
  • Appointment (a Date question). Click the three dots at the bottom right of the question and turn on Include time, so one answer holds both the day and the time.

In the form’s Responses tab, click Link to Sheets and create a new spreadsheet.

Step 2: Match the time zones

In the new spreadsheet, open File → Settings and check that Time zone is your own. The sheet reads the booked time in that zone. If it doesn’t match your calendar’s time zone, every event lands hours off.

Step 3: Add the script

In the spreadsheet, open Extensions → Apps Script, delete what’s there and paste this. Set the appointment length at the top:

const LENGTH_MINUTES = 60;   // how long each appointment lasts
const CALENDAR_ID = '';      // leave empty for your main calendar
const SEND_INVITE = false;   // true = email the customer a calendar invite
const Q = { name: 'Name', email: 'Email', service: 'Service', when: 'Appointment' };

function addBookingToCalendar(e) {
  if (!e || !e.range) {
    throw new Error('Test this by submitting the form, not with the Run button.');
  }
  const sheet = e.range.getSheet();
  const row = e.range.getRow();
  const headers = sheet.getRange(1, 1, 1, sheet.getLastColumn()).getValues()[0];
  const values = sheet.getRange(row, 1, 1, headers.length).getValues()[0];
  const get = function (name) {
    const i = headers.indexOf(name);
    return i === -1 ? '' : values[i];
  };

  const start = get(Q.when);
  if (!(start instanceof Date)) {
    note(sheet, row, headers, 'Not added: no date and time in "' + Q.when + '"');
    return;
  }
  const end = new Date(start.getTime() + LENGTH_MINUTES * 60 * 1000);
  const calendar = CALENDAR_ID ? CalendarApp.getCalendarById(CALENDAR_ID)
                               : CalendarApp.getDefaultCalendar();
  const title = get(Q.service) + ': ' + get(Q.name);

  if (calendar.getEvents(start, end).length > 0) {
    note(sheet, row, headers, 'CLASH, not added');
    MailApp.sendEmail(Session.getEffectiveUser().getEmail(),
      'Booking clash: ' + title,
      title + ' asked for ' + start + ', but that time is already booked.\n' +
      'Customer email: ' + get(Q.email));
    return;
  }

  const options = {
    description: 'Booked through the form.\nEmail: ' + get(Q.email),
  };
  if (SEND_INVITE && get(Q.email)) {
    options.guests = String(get(Q.email)).trim();
    options.sendInvites = true;
  }
  calendar.createEvent(title, start, end, options);
  note(sheet, row, headers, 'Added');
}

function note(sheet, row, headers, text) {
  let col = headers.indexOf('Calendar') + 1;
  if (col === 0) {
    col = headers.length + 1;
    sheet.getRange(1, col).setValue('Calendar');
  }
  sheet.getRange(row, col).setValue(text);
}

Click Save.

Step 4: Add the trigger

  1. In Apps Script, click the clock icon (Triggers), then Add Trigger.
  2. Choose the function addBookingToCalendar, the event source From spreadsheet and the event type On form submit.
  3. Click Save and approve the permissions Google asks for. The script needs your calendar, the sheet and permission to email you about clashes. If Google says the app isn’t verified, that’s normal for your own script: click Advanced and continue.

Step 5: Test it

Open the form’s preview (the eye icon) and book a time tomorrow. Within a few seconds, the event should appear in Google Calendar and the row should say Added. Then book the same time again. The second row should say CLASH, not added, and you should get an email.

Don’t use Run in the editor to test. A manual run has no form answer, so it stops with the message at the top of the script.

Choosing a different calendar

To keep bookings off your personal calendar, create a calendar called Bookings. Open its Settings and sharing, scroll to Integrate calendar and copy the Calendar ID. Paste it between the quotes in CALENDAR_ID. The clash check then only looks at that calendar.

Common problems

What you seeLikely cause
Not added: no date and timeThe question isn’t called exactly Appointment, or Include time is off, so the answer is only a date.
Events are a few hours offThe sheet’s time zone (Step 2) differs from your calendar’s.
Two events for one bookingThe trigger was added twice. Delete one on the Triggers page.
Event title shows only “: ”The Name and Service questions are named differently. Edit the names in Q.
An all-day event already on that day causes a clashAll-day events count as busy. Move them to another calendar, or keep bookings in their own calendar as described above.

What this doesn’t do

  • The form can’t hide times that are already taken. Customers can still pick them, and the script catches the clash afterwards. If you need live availability, use a booking tool, such as the appointment schedules built into Google Calendar on some plans.
  • It doesn’t check opening hours. Add a sentence to the form about when you’re open, or ask for a preferred time and confirm it by reply.
  • Cancelling still happens in the calendar. Deleting a row from the sheet doesn’t remove the event.

Want reminders and confirmations too?

I build booking and form automations for small businesses: confirmation emails, reminders the day before, opening-hours checks and a weekly schedule sheet. You get clean code in your own Google account and a short how-to.