Add a custom menu when the sheet opens

Adds a "Tools" menu to the spreadsheet that runs your own functions.

function onOpen() {
  SpreadsheetApp.getUi()
    .createMenu('Tools')
    .addItem('Weekly summary now', 'sendWeeklySummary')
    .addItem('Remove duplicate rows', 'removeDuplicates')
    .addToUi();
}

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: onOpen is a simple trigger: it runs automatically with no setup, but cannot do things that need authorization until you run them once from the menu.

Undo: Delete the function; the menu disappears on the next open.

Reference: Apps Script documentation.

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