Auto move google events to specific calendar based on title

Elvis Ciotti
2 min readOct 17, 2024

--

E.g. events named “sport xyz” will be auto moved to calendar “sport” and named “xyz”

To do this, I’ve used pipedream.com

Create a new workflow with

step1: trigger: New Created or Updated Event (Instant) from Google Calendar

and xhoose the calendar where you add the events

step2: code (node.js): step to add the calendar name (based on the title) and the new event name

With this code I’,m adding calendarToUse and eventNameNoTag to the context


export default defineComponent({
async run({ steps, $ }) {

let calendarToUse = null; // planned
const eventName =steps.trigger.event.summary;
if (eventName.startsWith('sport ')) {
calendarToUse='COPY_FROM_GOOGLE_CALENDAR_EXPORT_PAGE@group.calendar.google.com';
}
if (eventName.startsWith('fun')) {
calendarToUse='COPY_FROM_GOOGLE_CALENDAR_EXPORT_PAGE@group.calendar.google.com';
}



const eventNameNoTag=eventName
.replace(/^(sport|fun)/,'')
;


console.error(eventName);
// Reference previous step data using the steps object and return data to use it in future steps
return {...steps.trigger.event, calendarToUse, eventNameNoTag};
},
})

step3: end if prefix not found

Simply add a condition to end if the var above is not calculated

step4: add new event to new calendar

I didn’t find a way to move to a calendar, so I’m making a copy including description. use calendarToUse as calendar ID, and eventNameNoTag as event title, then copy start date, end date and description

step5: delete original event

you can do this later if you want to test it for a while first.

Create an event delete action using the trigger.event.it (the original event created)

--

--

Elvis Ciotti
Elvis Ciotti

Written by Elvis Ciotti

Software Contractor — Java, Spring, k8s, AWS, Javascript @ London - hire me at https://elvisciotti.github.io/

No responses yet