Closed Gewerd-Strauss closed 7 months ago
Are you asking for the full URL of the .ics source file? Or more like a friendly name of that calendar?
I am interested in the full url used to fetch the calendar:
var sourceCalendars = [ // The ics/ical urls that you want to get events from along with their target calendars (list a new row for each mapping of ICS url to Google Calendar)
// For instance: ["https://www.calendarlabs.com/ical-calendar/ics/76/US_Holidays.ics", "US Holidays"]
["https://gist.githubusercontent.com/username/hash/raw/name.ics", "schedules"],
//["icsUrl3", "targetCalendar1"]
];
as defined in code.gs.
Thus, the calendar-description for the calendar schedules
should contain https://gist.githubusercontent.com/username/hash/raw/name.ics
.
@Gewerd-Strauss
Change
https://github.com/derekantrican/GAS-ICS-Sync/blob/17cde1a768ad4c6d5ede0e7401e20606fff0be2a/Code.gs#L180
to
var targetCalendar = setupTargetCalendar(targetCalendarName, sourceCalendarURLs);
Change
https://github.com/derekantrican/GAS-ICS-Sync/blob/17cde1a768ad4c6d5ede0e7401e20606fff0be2a/Helpers.gs#L178
to
function setupTargetCalendar(targetCalendarName, sourceURLs){
Replace https://github.com/derekantrican/GAS-ICS-Sync/blob/17cde1a768ad4c6d5ede0e7401e20606fff0be2a/Helpers.gs#L188 with
let descriptionString = "Created by GAS\nSyncing:";
for (let url of sourceURLs){
descriptionString += `\n${url[0]}`;
}
targetCalendar.description = descriptionString;
Keep in mind that the description is only set on calendar creation.
Thank you for your solution, this seems to work well.
There was a small issue I was able to fix in Helpers.gs
:
descriptionString += `\n${url[0]}`;
would only paste the first character of the string in url
into the description, instead of the whole URL. Changing it to
descriptionString += `\n${url}`;
resolves this issue. I will thus close this issue now.
P.S.: I would like to apologise for my late reply, I am currently utterly busy and replying to you fell off my radar as a result-
Hello,
this is an amazing script, but there's one small improvement I'd like to see.
When using this script to add several calendars, it can get somewhat annoying to check the source URL quickly - you cannot do so from google Calendar, instead you have to open the script first and get the URL from there.
Hence, I would suggest inserting the source-URL of the respective calendar into the description (which as of right now is only "Created by GAS"), so that the source can be accessed from google Calendar as well.
Thank you.
Sincerely,
~Gw