Compare Two Calendars/Create New Event(s)

Hello:

I subscribe to a shared work shifts calendar that I would like to sync with a local calendar, that I can share with family members.
I’ve created a shortcut that can find all events for a set number of days from the shared calendar—> repeat each item of calendar events etc.
And then find all events with a start date from the local calendar and create a new event with new title etc. for all the matches.
However, I can’t figure out how to create a shortcut that compares both calendars and only creates a new event(s) in the local calendar, if it hasn’t already been created.
So, say I run the shortcut once for the next seven days and it creates new events taken from the shared calendar.
I’d like a way to just run the shortcut (maybe even use it in a automation) three days later, for example, and it just adds what ever new shifts have been added in that timeframe without duplicating the past events.
I’ve tried, but failed at filtering variables etc. to only create new events, and I’m stuck. I’ve searched Reddit and found similar use cases, but not this one.
Any help would be much appreciated!

Thanks—Rob

One approach would be to search for and delete events with the same start and end times before creating new ones. However, this would require searching for each event individually, which can be time-consuming.

A perhaps more efficient method is to delete all events within the date range and then recreate them all. I’ve recently done this with hundreds of events, and it only takes a few seconds. You can even set up a daily automation to handle this, so you won’t have to think about it again. :slightly_smiling_face:

Ok, thanks for the suggestion. I’ll try that, but what about events not related, but falling within that timeframe, that I do not want to be deleted?

A way to handle that is to tag the synced events, like adding an emoji to the title or “Synced!” in the Notes field. Then, you can filter by that tag to delete only those events without affecting unrelated ones.

I do something similar - I have a Shortcut run every day that copies all my work events from my Outlook calendar to a shared iCloud calendar, replacing the title with “Jimmy In A Meeting”. It allows my wife to see my availability without seeing the meeting titles, which are sometimes confidential.

Two things that make this easy for me:

  1. A dedicated Calendar for these events. Saves a lot of filtering/searching/tagging when I can just use the “Get Upcoming Events” > FROM > a single calendar.
  2. as @atnbueno mentioned, I just delete EVERYTHING on that calendar in the time frame and recreate all the events every time. It’s super fast, reliable, and saves a ton of mucking about with matching search criteria.

One thing to keep in mind with this approach is notifications. If the shared calendar triggers notifications for the participants, they’ll get a whole new batch of notifications (maybe double - one for the delete and one for the create) for events every time it’s run.

1 Like

Thanks, for your insight.
Your situation seems similar to mine.
I’ll try and put a shortcut incorporating the suggestions given by you both.

Rob