Best answer

Google: Create Calendar Event from New/Updated Sheet Row "Only If" no event exists

  • 11 April 2024
  • 3 replies
  • 37 views

Hi Community and TIA.

TL;DR question: ways to ensure duplicate events aren’t created in Gcal based on user error updating or reformatting Gsheet

I’ve included screen shots of the Zap and the Sheet Tabs referenced. Leaving out screenshots of the actual tabs/sheets as they contain guest information.

I have a long working Zap to manage short-term rental bookings that adds departure and arrival events to GCal based on new/updated rows in a Gsheet (GSheet is “Contact Info). The trigger is Col 5 where the arrival date is stored. The vast majority of use cases are for new bookings, which function as expected. The only real problem I run into is when I either:

  • update an arrival date in the Gsheet to reflect a new arrival date
  • rearrange the sheet (Filter View or re-sort) 

Obviously, the easy answer is to turn off the Zap when doing so but that relies on human activity and is therefore subject to human error. (This Zap also creates arrival and departure emails but, since that’s a separate function, I’m not as concerned, but it’s also creates a duplicate draft email for departure and arrival). If I just mess with a date in one row, it’s not of great consequence but when I re-sort or Filter View or make global changes to the sheet, I get duplicate events and emails for every single row which can be time consuming to remove and only gets more time consuming as the year goes on

 With all of the additional functionality now available to small-time users like me (Thanks Zapier for Filters and Paths!), I’m re-thinking all of my architecture and trying to eliminate human error (hahahahah) from the equation. Looking for error-proofing solutions that are better than what I’ve come up with.

  1. My desired original solution was to add a Filter immediately after the first step that would check to see if the GCal event already existed and, if so, either modify the event (event date has changed in Col5 from existing GCal event) or cancel (event date matches the Col5) any further actions. However, I can’t figure out if it’s even possible to use GCal as a trigger for that since the original zap begins with “New/Updated Row In Sheet”. It only seems to want to check the data from the original trigger and not from other sources. If anyone can confirm this is possible/not possible, or suggest a workaround, that would be helpful.
  2. A secondary solution I thought about was creating a separate zap to check GCal for an event matching the departure date and/or perhaps another piece of confirming information (guest name? email?) and checking a True/False checkbox at the end of that sheet row. Then I could add a Filter function on the original zap that would look to that checkbox for False (e.g. not already created) before creating a new one and/or modifying original if I could figure out how to finagle that. At a minimum, a “True” result (separate Zap has verified this event has been created)  should prevent the rest of the zap from creating duplicates, right?
  3. I also thought about having the Filter reference the dates in the “Form Responses” Tab where the same info is stored. If the date matches, the Form Response tab then nothing happens. If the date doesn’t, it would create a new event (or modify the original, if I can figure out how). That would only work for updating dates in “Contact Info” sheet though and I’m not sure how it would create new GCal events as it will already match. I might have to make that a totally new Zap (New Row at at bottom of sheet trigger) in order to isolate Updated from New events?
    • I copy and paste the Unique ID from the “Timestamp” (Col1) on that tab into the “Booking ID” (Col 1) on the “Contact Info” tab as the trigger action for the whole zap. (Clarifying info, Mailparser.io strips almost all of the necessary information from AirBnB and VRBO inbound emails and populates the Form Responses tab except for independent bookings. They don’t paste email or - for AirBnB - phone numbers into the Form Response tab so I manually add those and then trigger the Zap run by the copy and paste into the Contact Info. That’s probably TMI but may be helpful for someone who thinks there’s a better way to do the whole process.
  4. Other methods I’m not considering?

To try and summarize what actions I want to occur, for clarity:

  • New GSheet Row with Arrival Date (Col 5 in “Contact Info”) event triggers Departure and Arrival events in GCal only if events do not already exist. AND
  • Updated Arrival Date Sheet Row (change to Col 5 in “Contact Info”) creates New GCal Arrival event (or modifies existing?) but does not create or modify any other events.

Separately, none of this addresses changes to departure dates (which also happens) but I figure I can do that with a duplicate Zap targeting Col6 (End date) instead of Col 5 (Start date) or possibly with more conditional logic looking for a change to Col5 OR Col6, depending on the solutions you guys come up with. Sorry for exchanging brevity for (hopefully) clarity.

 

icon

Best answer by SamB 12 April 2024, 13:50

View original

3 replies

Userlevel 7
Badge +11

Hi @Crayhead 👋

Welcome to the Community, and thanks for sharing all these details here - it’s super helpful! 

Doing things like rearranging the sheet would indeed require you to turn the Zap off when making those sorts of changes. I wonder if it might be worth looking into using Zapier Tables instead as you’d be able to make those sort of changes to the sheet without causing any issues. As the table would reference the record’s ID not the row ID which as you’ve discovered with Google Sheets would change if the spreadsheet is sorted, or a row gets deleted etc. 

In order to prevent duplicate events from being created the best way to do that would be to set a unique value for the event that could be used for the search. Since there’s events for arrival and departures I’d have thought that you’d want the events to all have the same naming format of something like “Booking ID - Arrival” for arrival events and “Booking ID - Departure” for the departure events. That way you could ensure that the Find Event action is able to correctly find the event, and avoid duplicate events being created.

For example:
f8bd9eb0e95e78fb3b1409e3912151f4.png

And you could have a separate Find Event action that checks for the departure date event. 

When an event isn’t found we see a false value in the Zap Data Was Found field:

4f3bc260328c9a6465d9a7fd94423401.png

So you could set up a rule condition in a filter or path to check whether that Zap Data Was Found field was true (meaning it found an existing event) or false (indicating that a new event was created). For example:
286a284e1dcd3ad9b00def41ba9287e0.png

Then for the filter/path that checks that the field has a value of “true”, you’d have an Update Event action to update the event’s start date to the new arrival date. To ensure it updates the event was found you’d need to choose the Custom value option and select the ID for the event that’s output by the Find Event action. For example:

d9e00efd42213c75de322a2fc475680f.png

That sort of approach should ensure that the Zap is able to find and update existing events, or create new events without duplicate events being created.

Do you think that could work for your needs here? Looking forward to hearing from you!

Hey SamB! Thanks for all of your input. I have been working on an overhaul to address your thoughts and existing shortcomings. I’ve attached a screenshot of where I am at this moment. The critical changes are:

  1. Changed the original trigger to New Row (only, not update).
    1. Planning to address date changes to calendar appts. in a separate Zap. Will use your guideline for implementation to kick it off.
    2. Agreed that including the unique identifier on the Calendar appt is smart. Already had a uniform format but now reads “[Unique ID] - [Booking source] Arrival/Departure: [Guest First] [Guest Last]”. Should make locating those events easier.
  2. Moved all the data to Zapier Tables, new rows added with new rows created in Contact Info tab
Userlevel 7
Badge +11

Glad I could help, @Crayhead! 🤗 

I spotted in the screenshot that the trigger for the Zap is New Row for Google Sheets, but you mentioned that you’ve moved the data over to Zapier Tables. So if you’ve not done so already, you’ll want to update that to the equivalent Zapier Tables (New Record) trigger instead so it will trigger when a new record is added to the table.

Other than that it all sounds good to me! Keep us updated on how the rest of the changes go and if you get stuck or run into any further issues at all just let me know - happy to help further!

Reply