Highlight overdue dates in red

Colors any date in column B that is before today.

function highlightOverdue() {
  const sheet = SpreadsheetApp.getActiveSheet();
  const range = sheet.getRange(2, 2, sheet.getLastRow() - 1, 1);
  const today = new Date(); today.setHours(0, 0, 0, 0);
  const colors = range.getValues().map(([d]) => [d instanceof Date && d < today ? '#ffd6d6' : null]);
  range.setBackgrounds(colors);
}

How to install

  1. Open the spreadsheet, then Extensions > Apps Script.
  2. Paste the code, click Save.
  3. Choose the function in the toolbar and click Run once; approve the permissions screen (it lists exactly what the script can touch).
Safety: Conditional formatting can do this without a script; use the script when you also want to email or move the rows.

Undo: Format > Clear formatting on column B.

Reference: Apps Script documentation.

Facts on this page checked December 4, 2026 (Pacific) against the linked official sources.