Giter VIP home page Giter VIP logo

sync-multiple-google-calendars's Introduction

Sync Multiple Google Calendars into One

Sync Multiple Google Calendars into One

When you want to sync multiple Google Calendars into one. Currently Google Calendar doesn't have this option and IFTTT/Zapier don't allow an easy way to do this.

This is useful for a collective Busy/Free Calendar or Google Home integration.

Getting Starting

  1. Make sure every calendar you want sync is shared with the account that holds the shared calendar.

  2. Log into the account that holds the shared calendar and go to the Google Apps Scripts website.

  3. Click on "New Project".

  4. Replace everything in Code.gs with the contents of SyncCalendarsIntoOne.gs.

  5. Create a new script file called BatchRequests.gs with the contents of BatchRequests.gs

  6. Update calendarsToMerge, calendarToMergeInto, SYNC_DAYS_IN_PAST, and SYNC_DAYS_IN_FUTURE variables. Be sure to save.

  7. Click the Project Settings Gear icon on the left panel. Check the Show "appsscript.json" manifest file in editor. Go back to code editor on the left, and update its content with appsscript.json.

  8. Click Run. This will load the Authorization required window since it's your first time running the script. Click on Review permissions and give it permission to your account.

  9. Click on Triggers clock icon on the left panel to add a trigger. Click on Add Trigger.

    • You have two choices, "Time-driven" or "From calendar".

    • Time-driven will run every X minutes/hours/etc. Use this if you have calendars that update frequently (more than 5-10 times in a 15 minute timespan)

    • "From calendar" will run when a given calendar updates. Use this if you want instant merging.

      a. Time-driven

      • "Choose which function to run": SyncCalendarsIntoOne
      • "Choose which deployment should run": Head
      • "Select event source": Time-driven
      • "Select type of time based trigger": choose what works for you.
      • Click "Save"

      b. From calendar

      • "Choose which function to run": SyncCalendarsIntoOne
      • "Choose which deployment should run": Head
      • "Select event source": From calendar
      • "Enter calendar details": enter one of the calendars you are merging from.
      • Click "Save"
      • Repeat these steps for every calendar you're merging from.
  10. Enjoy!

Notes

  • Google App Scripts has a daily quote of 5k events created per day. See Quotas for Google Services
  • Be sure to turn off "notifications".

Icon Attributions

event favorite, event unknown, and event warning by arjuazka from the Noun Project Merge by Travis Avery from the Noun Project

License

MIT © Ali Karbassi

sync-multiple-google-calendars's People

Contributors

antja0 avatar bonzofenix avatar camillof avatar karbassi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sync-multiple-google-calendars's Issues

All-day and multi-day events are skipped

Prerequisites

  • Have you searched for existing issues (open and close) to see if the bug or feature request has already been reported?
  • If this is a bug report, are you running the latest version? If not, please update to the latest version and verify that the issue still occurs before proceding.
  • Have you read the Contributing Guide?
  • Have you reviewed the project readme (you might find advice about creating new issues)?
  • Are you creating an issue in the correct repository? (if this related to a dependency, please create the issue on that repository)

Ready? Great! Please provide the following details:

Version

fac667b on Dec 8, 2022

Description

Please decribe the bug or feature, along with:

  • Expected behavior and actual behavior.
  • Steps to reproduce the problem.

Expected behavior: All events, including all-day and multi-day events, will be merged into the destination calendar
Actual behavior: Only partial-day events are merged into the destination calendar. All-day and multi-day events are not copied over.

I think this may be due to how Google Calendar represents all-day events with the date property instead of with dateTime, however I am not experienced enough as a developer to fix the problem myself.

Error message

# please paste any error messages here

Sync all-day appointments?

Hey, thanks for your effort!
This tool really helps me in my daily life. I however can't find the option to sync my all-day appointments. Is this even possible or am I just missing something? Can I help you on implementing it? I'm very new with Google Apps script and the Calendar API so I don't really know how to "fix"/add this. :/

Best regards!

Step 4: Updating appsscript.json

First, thanks for this! It's a huge help to me and really just wanted to say thank you.

Figured I'd make a small contribution while I'm here.

Step 4 (appsscript.json) of the current setup process needs a slight tweak because Google changed the Apps Script layout.

  1. Click the Project Settings Gear icon on the left. Check the Show "appsscript.json" manifest file in editor. Go back to code editor on the left, and insert this into the new script file.

I would like to sync multi-day and recurring events also. How do we change the code to be able to do this?

Prerequisites

  • Have you searched for existing issues (open and close) to see if the bug or feature request has already been reported?
  • If this is a bug report, are you running the latest version? If not, please update to the latest version and verify that the issue still occurs before proceding.
  • Have you read the Contributing Guide?
  • Have you reviewed the project readme (you might find advice about creating new issues)?
  • Are you creating an issue in the correct repository? (if this related to a dependency, please create the issue on that repository)

Ready? Great! Please provide the following details:

Version

[version]

Description

Please decribe the bug or feature, along with:

  • Expected behavior and actual behavior.
  • Steps to reproduce the problem.

[description]

Error message

# please paste any error messages here

ReferenceError: Calendar is not defined createEvents

Won't syn at all.

Prerequisites

  • [ X] Have you searched for existing issues (open and close) to see if the bug or feature request has already been reported?
  • [X ] If this is a bug report, are you running the latest version? If not, please update to the latest version and verify that the issue still occurs before proceding.
  • [X ] Have you read the Contributing Guide?
  • [X ] Have you reviewed the project readme (you might find advice about creating new issues)?
  • [X ] Are you creating an issue in the correct repository? (if this related to a dependency, please create the issue on that repository)

Ready? Great! Please provide the following details:

Version

Latest

Description

Please decribe the bug or feature, along with:

  • Expected behavior and actual behavior.
  • Steps to reproduce the problem.

[description]

Error message

6:58:16 PM Error
ReferenceError: Calendar is not defined
createEvents @ Code.gs:102
SyncCalendarsIntoOne @ Code.gs:51

all future meetings cancelled

Hi,
Last time i tried to use this, it cancelled all future (work)meetings.
Which was quite fun :-p
It seemed to work well for the rest.
I combined 3 calendars into 1 so all unavailabilities would be visible to others.
Is this issue solved ?

Thanks!

Calendar ID's as Main Account Email

I'm having an issue with appointments not pulling from calendars that my primary account has access to, but they are the primary calendar for the other account. That's confusing, so let me break it down.

Primary Account = Where the script is running and the one with all the access.
Account 1 = The primary calendar is being shared for the account.
Account 2 = The primary calendar is being shared for the account.

For Accounts 1 and 2, the Calendar ID is the account's email, not a generated calendar id email. I have full read/write access to all of them, but I can't pull anything from them.

Any ideas?

Thanks, and awesome script!

Possible to sync events from a URL calendar

Is it possible to sync events from a calendar I can only access via URL.
I've subscribed to the calendar in my google calendar and it comes up as "other calendar"
It would be really great if I could use this tool to automatically merge events from that calendar into my main google calendar.
Inputting the correct calendar IDs into the code, I don't get any errors when running the code but also no new events are created.
Am I missing something or am I just stupid and haven't realised this isn't possible?

Preservation of the initial contents

Hi @karbassi!

Thank you for sharing the script. It seems to be very useful for a use case when there is a need to share cals from multiple accounts as a single cal. A few questions:

  1. I can see that before merging the script removes all events from the destination calendar (not only events merged on a previous iteration). So if there were any events in the destination calendar -- they're lost. Is it intended behavior or I'm doing something wrong?

  2. If (1) is intended, do you have any plans on changing this behavior to preserve initial events in the destination calendar?

  3. If (2) is "yes", would you accept a PR with the fix? It seems straightforward, though I've never done anything around Google Apps before. Do you think there may be any pitfalls?

-- Dmitri

Multiple account support

Hello, I would like to ask a question. Can this script be used (modified) to link multiple accounts?

Example: I have one personal and several work accounts, but they do not allow sharing details in the calendar, so instead of seeing in the calendar that I am busy, I would like to synchronize them in this way.

Thanks!

I want my personal events to be titled as busy on my work calendar so that personal event details are not shared at work

New feature request: Set at the calendar level if all event details should be copied over, or if they just be blank and titled "busy"

User stories

  • I want my personal events to be titled as busy on my work calendar so that personal event details are not shared at work
  • I want my work event details to be retained on my personal calendar so that I can use my personal calendar as my primary calendar

Update existing events instead of replacing them

Hi,
is it possible to add functionality such that events are updated when they've changed, instead of always deleting/creating all?
The problem with the latter is that if you merge into a calendar that is subscribed to by other people (who may have email notifications turned on), then that can easily lead to your gmail account sending out hundreds of emails, which you have no control over.

The events should by identifiable by their respective event ids, should they not?

Of course you would need to loop over all events in the specified time frame of the calendar you want to merge into.

invalid argument

Prerequisites

  • [y ] Have you searched for existing issues (open and close) to see if the bug or feature request has already been reported?
  • [ y] If this is a bug report, are you running the latest version? If not, please update to the latest version and verify that the issue still occurs before proceding.
  • [ y] Have you read the Contributing Guide?
  • [ y] Have you reviewed the project readme (you might find advice about creating new issues)?
  • [ y] Are you creating an issue in the correct repository? (if this related to a dependency, please create the issue on that repository)

Ready? Great! Please provide the following details:

Version

e42bcee

Description

Script doesn't run

[description]

Error message

Exception: Invalid argument: startTime
    at deleteEvents

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.