I know how to add external calendars (in .ics format) to Google Calendar manually. Is there any way to do it from within a Google Apps Script? That is, is there a command that imports from a provided .ics file? I'd like to build a script that triggers on a regular basis and imports all events from a particular .ics file over a particular timeframe.
2 Answers
I wrote a script that does something like this: https://script.google.com/d/1BOk8MDLbLaHh6SwG1M1tsgNXjkcC-79LE0QoipRuTDxbO3fMVvqoROQD/edit?usp=sharing
Currently it only adds events (so it doesn't update/delete events that have been changed) but you can contribute to it here: https://github.com/derekantrican/GAS-ICS-Sync
I was looking for this as well, alas to no avail. You have to parse the .ics file or use the NPM package. That can be quite difficult seeing as timezones in Google Script are just offsets, no DST. Here's my code that will scan Gmail for a label, grab .ics attachments and post them in a calendar. Make sure the Script Timezone is the same as in the .ics. Hope it helps.
https://github.com/brett-schneider/gmail_ics_attachment_to_calendar