Syncing Google calendars into one

Describe the issue/error/question

Hello. I’m going out with my friends and all friends have google caneldars where they marking events. However i’ve been thinking how could i automate it (so we don’t have to ask every time if everyone has time for specific event) and share each calendar between each other. As i do have second calendar shared with my girlfriend, i would want to share this calendar as well but i’d need to determine who is busy by specifying event author (and ideally hosts as there might be an event where i go with my girlfriend - so we’re both busy).

So i’ve started scrolling community workflows and found workflow n.o. 1118 “Sync Google Calendar tasks to Trello every day”. It basically sync upcomming 24 hours and checks for changes every day. However i don’t really like that system and looking for something easier / more clear to understand. Also, i’d like to sync many calendars into one and edit the event name by it’s author (example: event named “Anthony is busy” with specified time). I need syncing because if someone do have something in saturday 8 PM, and then he’ll delete the event (so he does time for us now), i want to delete this specific event in our group calendar as well.

Is there any possibility of doing so? Ideally with sync window of 6 months from date of starting the sync action (checking once a day).

Please share the workflow

This is the workflow i mentioned earlier, named " Sync Google Calendar tasks to Trello every day"

Information on your n8n setup

  • n8n version: 0.217.1
  • Database you’re using (default: SQLite): Postgres
  • Running n8n with the execution process [own(default), main]:
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: Docker

This is what the Compare Datasets node is designed to do.

Below is a rough outline of how such a workflow could look — it will no doubt need to be modified, but can serve as a starting point. A word of caution that things like recurring events might be problematic and require extra logic to handle properly.

Thank you for reply. I’ve been digging and editing your template workflow until i’ve come into issue.

I made A to B sync (so everything in A will sync to B but nothing from B will sync to A) and here comes the issue. n8n will throw all B events as “different” branch. I don’t know why as all the match conditions in Compare Datasets are same in both A and B events.

They all should be in “same” branch.

If you’d like help, it would be useful to share your workflow. Can you paste it in a post?

Maybe it somehow didn’t show you the workflow. I pasted it into the comment as i was writing it. :slight_smile:

In the ‘compare datasets’ node, if you change the ‘when there are differences’ field to ‘include both versions’ you can see exactly what the differences are.

If it’s a field that’s always going to be different (e.g. ‘id’) you can then make the node ignore it.

And apologies I didn’t see your workflow before; I was on mobile and missed it

Yup. Did it and see that the timezone is different.
image

However the times are exactly the same and i set to compare only dateTime, not timeZone so i don’t understand why n8n keeps saying there’s difference.

I tried to do it the different way than drag ‘n’ drop method like:
image

Results in something like:

Also, here’s the error code:

Error: Field '2023-03-09T17:00:00+01:00' is not present in any of items in 'Input A'
    at checkInput (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/CompareDatasets/GenericFunctions.js:272:19)
    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/CompareDatasets/CompareDatasets.node.js:201:58)
    at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:658:51)
    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:590:68
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Is there a way to fix this? They’re clearly the same outputs then why it’s saying there’s difference?

The compare datasets node works in two steps:

1) Pair items together to compare
In this step, it tries to find the same item in both inputs. It does this using a primary key made up of the fields you specify at the top of the node. So these fields should uniquely identify an item. What you originally had (name, start, end) looked good for this

2) For paired items, compare all other fields to see if they’re the same or different
Once items are paired, they go to either the ‘same’ or ‘different’ branch depending on whether all the other fields match

So if the difference is the time zone and it shouldn’t be counted as a difference, you need to add that field to the ‘fields to ignore’ parameter.

Right. So by default it compares all the fields? Or rather all the sub-fields of field i defined?

In this case field would be start / end and subfields would be dateTime and timeZone.

In which step?
In step 1 it compares the fields you specify
In step 2 it compares all the fields, apart from any you specifically exclude

Ah, right. But can I somehow disable step 2 so i don’t need to manually exclude every field i don’t want to compare?

Because I already specified the fields to compare but I don’t want to compare anything else.

If you don’t care whether matched items are exactly the same or different, you have two options:

  1. Wire up the ‘same’ and ‘different’ outputs of the ‘compare datasets’ node to the same following node
  2. Put ‘set’ nodes before the ‘compare datasets’ inputs and only pass through the fields you care about

No, i care about items that i set in matching fields. I don’t care about everything else. The fact here is that i (among many others) might found a bug in n8n that needs investigation.

What i want to achieve is now both - find out if it is really a bug or not, and how can i temporarly workaround it.

The matching fields i filled are all clearly the same from what i see and n8n agrees on “summary” field like shown here:
image

However, n8n tells me that start.dateTime and end.dateTime aren’t equal for those two calendar events data i compare like shown here:

Did you try excluding the time zone fields?

(It would be helpful if you could share your entire workflow — it makes these things much easier to debug)

image

Yes i did.

Here’s the workflow:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.