I have the following var:
var isEventLinkBlank = ssa.getSheetByName("Tracker").getRange(index, 13).isBlank();
It's used to check if a certain column is blank or not, which I then use within an if statement. The if statement is perfect, but I want to figure out the else statement where it is the case that the column is actually filled.
else {
ss.toast("New date found and updated!", "Notice", 25);
const viewInvite = sheet.getRange(index, 13).getFormula();
// or const viewInvite = '=HYPERLINK("https://www.google.com/calendar/u/0/r/eventedit/';
const getEventId = viewInvite.substring(viewInvite.lastIndexOf("r/") + 2, viewInvite.lastIndexOf("/"));
Logger.log(getEventId);
var timeOfEvent = Utilities.base64Decode(getEventId.split("=")).getStartTime();
isEventLinkBlank = interview_date.setValue(timeOfEvent);
}
When the column is filled, there will be a formula that is sitting there:
=HYPERLINK("https://www.google.com/calendar/u/0/r/eventedit/XXXXXXXXXXXXXXXXX","View Invite")
So far the code posted above should:
- read that formula
- get the XXXXXXXX portion only
- decode that XXXXXXXX portion (which is both the event ID and calendar ID from what I decoded)
- split the event ID away from the calendar ID in what is decoded
- utilize the decoded event ID to get the start time of the event (the date)
- and finally setValue that start time in the interview_date variable (which is a specified column).
But it spits out "undefined" and I've tried to rework it several times.
FYI the lastIndexOf solution was provided by a user but I can't seem to understand why "r/" is written, etc.
Thank you