I'm trying to setup a Custom Google Script to automatically color code my calendar based on keywords in the title. I have everything working properly, except for any events that start with a number.
Here's my script in question:
if (title.includes("1:1")) {
e.setColor(CalendarApp.EventColor.YELLOW);
}
CodePudding user response:
Find titles that begin with a number
title.match(/^\d /);
CodePudding user response:
Try this in onEdit()
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var sheet = spreadsheet.getActiveSheet();
var cellRange = sheet.getActiveCell();
var selectedColumn = cellRange.getColumn();
var selectedRow = cellRange.getRow();
sheet.getRange(selectedColumn,selectedRow).setBackground("red");
sheet.getRange(selectedColumn,selectedRow).setFontColor('white');