Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save gene1wood/02ed0d36f62d791518e452f55344240d to your computer and use it in GitHub Desktop.
Save gene1wood/02ed0d36f62d791518e452f55344240d to your computer and use it in GitHub Desktop.

Given a subscribed calendar with a url like

https://example.com/example.ics

To force Google Calendar to refresh and reload the contents right now, unsubscribe from the calendar and subscribe to a new calendar with a URL like

https://example.com/example.ics#1

Adding the anchor tag will force Google Calendar to think of it as a new calendar

Many people who come to this gist are not looking for a one time forced refresh but instead to refresh recurringly. If that's you, you should check out @derekantrican 's Google App Script

https://github.com/derekantrican/GAS-ICS-Sync

Which can refresh a calendar automatically every N minutes

https://script.google.com/home/projects/1BOk8MDLbLaHh6SwG1M1tsgNXjkcC-79LE0QoipRuTDxbO3fMVvqoROQD/edit

Thanks to @rattrayalex for pointing people to this script

@bverenkoff
Copy link

bverenkoff commented Oct 16, 2024

Great script, works great for my personal Apple iCloud calendar, but my shared family one shows as blank.

@jonas0b1011001
Copy link

Great script, works great for my personal Apple iCloud calendar, but my shared family one shows as blank.

Check https://script.google.com/home/executions for errors in the log.
Apple is adding a bunch of additional data to the ics that is not always conforming to the ical standard.

@bverenkoff
Copy link

Great script, works great for my personal Apple iCloud calendar, but my shared family one shows as blank.

Check https://script.google.com/home/executions for errors in the log. Apple is adding a bunch of additional data to the ics that is not always conforming to the ical standard.

Thanks, it's erroring out on something in the calendar (redacted some personal info):

ParserError: Missing parameter value in 'X-APPLE-STRUCTURED-LOCATION;VALUE=URI;X-ADDRESS=40XXX Sxxxth\nUnited States;X-APPLE-ABUID="Stephanie’s Home"::;X-TITLE=4xxxxxh'
at ICAL.parse.parser._handleContentLine(ical.js:1894:9)
at unknown function
at ICAL.parse.parser._eachLine(ical.js:2243:11)
at parser(ical.js:1769:12)
at parseResponses(Helpers:209:25)
at startSync(Code:209:17)

@jonas0b1011001
Copy link

Great script, works great for my personal Apple iCloud calendar, but my shared family one shows as blank.

Check https://script.google.com/home/executions for errors in the log. Apple is adding a bunch of additional data to the ics that is not always conforming to the ical standard.

Thanks, it's erroring out on something in the calendar (redacted some personal info):

ParserError: Missing parameter value in 'X-APPLE-STRUCTURED-LOCATION;VALUE=URI;X-ADDRESS=40XXX Sxxxth\nUnited States;X-APPLE-ABUID="Stephanie’s Home"::;X-TITLE=4xxxxxh' at ICAL.parse.parser._handleContentLine(ical.js:1894:9) at unknown function at ICAL.parse.parser._eachLine(ical.js:2243:11) at parser(ical.js:1769:12) at parseResponses(Helpers:209:25) at startSync(Code:209:17)

derekantrican/GAS-ICS-Sync#351

@bverenkoff
Copy link

Thank you. Yeah I recognized the metadata and recreated the event. Strangely that info wasn't in the invite, but some weird way my wife created it. I also commented out that exception. It sync'd perfectly after fixing that.

Thanks again.

@bverenkoff
Copy link

Got one more, despite "var addAlerts = "yes"; ", the alerts are not coming over into the GCal. Am I missing something, I've tested various methods and reminder times.

Screenshot 2024-10-16 at 12 00 18
Screenshot 2024-10-16 at 12 00 32

@jonas0b1011001
Copy link

Does it show the alert when opening the *.ics in a text editor?

@bverenkoff
Copy link

I see this in the ICS:
TRIGGER:-PT5M

@jonas0b1011001
Copy link

I just checked, var addAlerts = "yes"; works fine for me. What version are you running?

@bverenkoff
Copy link

I just checked, var addAlerts = "yes"; works fine for me. What version are you running?

Not sure where the version is posted, but I copied the script off this link this morning:
https://script.google.com/home/projects/1BOk8MDLbLaHh6SwG1M1tsgNXjkcC-79LE0QoipRuTDxbO3fMVvqoROQD/edit

@bverenkoff
Copy link

Here's the syntax around addAlerts:

Screenshot 2024-10-16 at 13 38 20

@jonas0b1011001
Copy link

That looks fine.
Can you share a full test event (BEGIN:VEVENT-END:VEVENT) with alarm that does not sync?

@bverenkoff
Copy link

That looks fine. Can you share a full test event (BEGIN:VEVENT-END:VEVENT) with alarm that does not sync?

BEGIN:VCALENDAR
CALSCALE:GREGORIAN
VERSION:2.0
X-WR-CALNAME:Test
METHOD:PUBLISH
PRODID:-//Apple Inc.//macOS 15.1//EN
BEGIN:VTIMEZONE
TZID:America/Chicago
BEGIN:DAYLIGHT
TZOFFSETFROM:-0600
DTSTART:20070311T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
TZNAME:CDT
TZOFFSETTO:-0500
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:-0500
DTSTART:20071104T020000
RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
TZNAME:CST
TZOFFSETTO:-0600
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
CREATED:20241016T184536Z
DTEND;TZID=America/Chicago:20241016T203000
TRANSP:OPAQUE
UID:D07D5FEA-F632-4984-A93C-6417F0251E48
X-APPLE-CREATOR-IDENTITY:com.apple.calendar
X-APPLE-CREATOR-TEAM-IDENTITY:0000000000
SUMMARY:Test
DTSTART;TZID=America/Chicago:20241016T201500
DTSTAMP:20241016T184618Z
LAST-MODIFIED:20241016T184536Z
SEQUENCE:0
BEGIN:VALARM
UID:8B05CF1B-497B-484A-8F1D-F14F67CBC1B7
X-WR-ALARMUID:8B05CF1B-497B-484A-8F1D-F14F67CBC1B7
TRIGGER:-PT15M
DESCRIPTION:Reminder
ACTION:DISPLAY
END:VALARM
END:VEVENT
END:VCALENDAR

@jonas0b1011001
Copy link

Works just fine with a fresh copy of the script you linked above. No settings changed. 🤷‍♂️
Bildschirmfoto 2024-10-16 um 20 55 42

@bverenkoff
Copy link

Works just fine with a fresh copy of the script you linked above. No settings changed. 🤷‍♂️ Bildschirmfoto 2024-10-16 um 20 55 42

Weird. I got a fresh script and tried, and same thing. I also tried it on a different Gmail account/calendar and still no invite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment