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

@jonas0b1011001
Copy link

I just put the same name for target calendar?

Yes

@Johnyryal
Copy link

Johnyryal commented Apr 3, 2024

Hi, this is just what I was looking for and have it setup and running. It has created and populated a new calendar in my google calendar with the ics data. I have added a new entry in the iCal source to see that it is working. When it runs I don't ever see the new entry populate in the google calendar and under executions I get one of these two entries. Timing is set to every 15 minutes. Any thoughts or guidance would be helpful. Thanks.

Info - Completed:
Another iteration is currently running! Exiting...

Error - Failed:
DNS error: http://h
at callWithBackoff(Helpers:1078:9)
at fetchSourceCalendars(Helpers:136:5)
at startSync(Code:168:21)

@jonas0b1011001
Copy link

Hi, this is just what I was looking for and have it setup and running. It has created and populated a new calendar in my google calendar with the ics data. I have added a new entry in the iCal source to see that it is working. When it runs I don't ever see the new entry populate in the google calendar and under executions I get one of these two entries. Timing is set to every 15 minutes. Any thoughts or guidance would be helpful. Thanks.

Info - Completed: Another iteration is currently running! Exiting...

Error - Failed: DNS error: http://h at callWithBackoff(Helpers:1078:9) at fetchSourceCalendars(Helpers:136:5) at startSync(Code:168:21)

Your var sourceCalendars is missing a set of [], recheck with the given example.


Many of the questions asked here are already answered in the official repo of the script. As one of the maintainers, I can only encourage anyone to head over there if they are facing problems with the script!

@Johnyryal
Copy link

Hi, this is just what I was looking for and have it setup and running. It has created and populated a new calendar in my google calendar with the ics data. I have added a new entry in the iCal source to see that it is working. When it runs I don't ever see the new entry populate in the google calendar and under executions I get one of these two entries. Timing is set to every 15 minutes. Any thoughts or guidance would be helpful. Thanks.
Info - Completed: Another iteration is currently running! Exiting...
Error - Failed: DNS error: http://h at callWithBackoff(Helpers:1078:9) at fetchSourceCalendars(Helpers:136:5) at startSync(Code:168:21)

Your var sourceCalendars is missing a set of [], recheck with the given example.

Many of the questions asked here are already answered in the official repo of the script. As one of the maintainers, I can only encourage anyone to head over there if they are facing problems with the script!

Thank you @jonas0b1011001 for helping me correct my error. Sorry I couldn't find my answer in the repo. My error for "cleaning up" to much of the comments in that line. Many thanks!

@gene1wood
Copy link
Author

@jonas0b1011001 Given that most people who come to this gist are looking for functionality provided by your project ( https://github.com/derekantrican/GAS-ICS-Sync ), not for the trick outlined above about adding an anchor tag to a URL, is there anything you'd like to see me change/update about this gist to try to get those users away from this gist and over to your repo? Maybe I go through and try to delete some old comments in order to simplify this landing page so it's easier for people to find their way to your repo? Any ideas are welcome. I have a contact form linked on my GitHub profile, feel free to use it to email me with any ideas for how to improve this gist.

@woodenclock
Copy link

Thank you so much!
It worked perfectly!`

@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