Delete Spam Events from Google Calendar Automatically

Brian Fritton
Aug 28 · 5 min read
ARRRRRGH! SPAM through a new channel!

Calendar spam — the “GET A FREE NEW IPHONE!!! CELEBRATE!!! CLICK HERE!!!” — type of trash is not only annoying, but feels just a new level of invasive relative to email spam.

My calendar has started to fill up with these things, and there are other ways to defeat this but they all involve having events not display on your calendar until you accept them. That’s tough for me as I have other (legitimate) people inviting me to things all the time, and not seeing something until I’ve chosen to accept it creates serious scheduling problems.

Here’s an easy, free way to detect and delete them from your calendar with Zapier, a SaaS automation product.


Step 1

First, make a copy of this Google Sheet I made. This sheet has a list of popular spam terms I’ve started with. Since spam is spam, you’ll get different spam — so by copying this and creating your own, you will then be able to add terms to the sheet later on to “train” your auto-delete system.

Step 2

Create a test spam event in your calendar. Name it “Free iPhone”. No other details necessary. We need to do this now so Zapier picks up the correct test event. Setting this process up will (gasp!) automatically remove that test event later.

Step 3

Now sign up for Zapier and connect your Google Calendar app. It’s free and secure enough to be in use by major companies all around the globe. Note: I don’t work for them, just a bit fan for saving me time. Here’s a link that is a template which will set you up with the right skeleton to do the below…

Create a Zap that triggers off of any new event in Google Calendar. If you followed my template link, you will already have this and should see something similar to this:

Step 4

You’ll now configure the Zap to search the Google Sheet you copied for terms that are spammy. Add a “Google Sheets” step in between the trigger event and the delete event by clicking on the + icon.

Under “Choose Action Event” scroll down to search and selct “Lookup Spreadsheet Row”. You’ll then be asked to connect Zapier to your Google Sheets account. Do that.

Step 5

Now configure the Google Sheets search step like I have below. Your copied spam term sheet should show up at the top of the list under the “Spreadsheet” dropdown.

Once you complete that step, Zapier will ask you to try a lookup test out. Since we created that fake spam event earlier, it should find that one:

Step 6

Almost there. Now, we want to tell Zapier only to delete a calendar event IF it contained spam terms via that lookup sheet. To do that, add one more Action step after the Google Sheets step, before the Delete Event step (if you used the template link).

This step will be the “Filter” action. Configure it as shown.

This says, only continue with deleting an event if we found a row in the spam term lookup sheet that matches text in the event name we’re evaluating. This way, legitimate events don’t get deleted! YAY!

Step 7

If you have the Delete Event step already, click into it. If not, click the + icon under your Filter step to add it. Go through the first couple fields selecting your calendar, and then configure the event to delete like shown below:

Note: The “Custom Value for Event ID” will not appear until you select “Use a Custom Value (advanced) from the “Event” dropdown. If you see a ton of events in that dropdown, you can use the search box that appears to search for “Custom Value” and it’ll filter to it.

The “Step 1 ID” tag is under the “New Event” section of the dropdown. Select “ID”:

Click “New Event” and then scroll down to “ID” and select that.

Last Step!

Hit that “continue” button and allow Zapier to test deleting the event. You should see our test spam event disappear from your calendar. Hooray!

Your last step is to turn on the Zap permanently using the toggle on the bottom of the screen:

That’s it. Now Zapier will check your Calendar ever 15 minutes for spam events and delete them automatically.

You can add new spam terms to your sheet as they are not caught by this system. Next time they come in, the system will catch them and delete them for you. Note that the search for these terms uses the AND operator, so if you use multiple words like “free iphone” the event needs to match “free iphone” in part of its name to get deleted. An event just named “iphone” would not be deleted unless you had a term in your sheet for just “iphone”

Note: I take no responsibility for misconfigured Zaps and provide no support at all for this. Use at your own risk. If you do accidentally delete events, Google Calendar has a recycling bin you can recover them from.

You can check the Task History in Zapier to check how much spam it’s saved you from. :)

Havoc Shield

Security Tips and News Specifically for Startups

Brian Fritton

Written by

@PatchOfLand Co-Founder, Caffeine-loving technology enthusiast. Programming fiend and operations guy.

Havoc Shield

Security Tips and News Specifically for Startups

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade