Skip to content
// Sheets · Slack

Send a Slack alert when a Google Sheets tracker row becomes ready.

Preview which edits qualify, then connect one tracker tab to a Slack channel with an installable Apps Script trigger.

“When my team marks an item ready in the tracker, I want Slack to tell us which row to open.”

Rehearse a status change before connecting Slack

Try changing Tracker D7 from Open to Ready. You’ll see the exact message. Switch to Archive D7 or paste into D7:D8 and see whether either qualifies. The preview works offline with fictional edits.

Open the tracker previewSave the offline previewCheck which Slack destinations the notifier supports

Which orders became ready on this shift?

Two orders turn Ready in the same paste. If the next shift pastes those same statuses again, should it get a second notice? Try the order-ID practice in a blank Google Sheet. Its local receiver shows the message a packing desk could use.

  1. Open Extensions → Apps Script in a new spreadsheet. Replace the starter code with the order practice script, save it and run beginOrderPractice once. Approve access to this practice spreadsheet, then reload the spreadsheet before the first paste.
  2. In Order practice, paste these three lines into B2. All three orders started on Hold.
    Ready
    Hold
    Ready
  3. Open Local receiver. The message names PK-11 and PK-13. Paste the block again. The receiver keeps the same entries. Sort both order columns together and each ID keeps its own history.
  4. Set PK-11 to Hold, wait for “State saved” in the receiver, then type Ready. Only PK-11 appears in the new packing notice. Writing outside the status column leaves the receiver alone.

Keep IDs unique and fixed. An unfamiliar ID starts a baseline. The script compares the status it last observed for that ID with the status in the edited rows when the callback runs. Rapid edits can skip an intermediate state. This exercise stores up to 100 order IDs in your spreadsheet and makes no network requests.

Google Sheets edit eventsSimple triggersInstallable triggersSlack incoming webhooks

The script

copy · paste · trigger
notifySlackOnReady.gs
Apps Script
function trackerReadyMessage(e) {
  if (!e || !e.range) return '';
  const range = e.range;
  const sheet = range.getSheet();
  const column = 4;
  if (sheet.getName() !== 'Tracker') return '';
  if (range.getColumn() > column || range.getLastColumn() < column) return '';
  const first = Math.max(2, range.getRow());
  if (first > range.getLastRow()) return '';

  const ready = value => String(value || '').trim().toLowerCase() === 'ready';
  if (range.getNumRows() === 1 && range.getNumColumns() === 1) {
    if (!ready(e.value) || ready(e.oldValue)) return '';
    return 'Tracker row ' + first + ' is ready.';
  }

  // A block edit supplies no previous value for each cell.
  const last = Math.min(range.getLastRow(), sheet.getLastRow());
  if (last < first) return '';
  const statuses = sheet.getRange(first, column, last - first + 1, 1).getDisplayValues();
  let count = 0;
  const rows = [];
  statuses.forEach(([value], index) => {
    if (ready(value)) {
      count++;
      if (rows.length < 10) rows.push(first + index);
    }
  });
  if (!count) return '';
  const more = count > rows.length ? ' and ' + (count - rows.length) + ' more' : '';
  return 'Tracker edit: ' + count + (count === 1 ? ' row is' : ' rows are')
    + ' currently ready (row' + (count === 1 ? ' ' : 's ') + rows.join(', ') + more + ').';
}

// Install one spreadsheet On edit trigger for this function.
function notifySlackOnReady(e) {
  const text = trackerReadyMessage(e);
  if (!text) return;
  const url = PropertiesService.getScriptProperties().getProperty('SLACK_WEBHOOK_URL');
  if (!url) throw new Error('Set the SLACK_WEBHOOK_URL script property.');

  let response;
  try {
    response = UrlFetchApp.fetch(url, {
      method: 'post',
      contentType: 'application/json',
      payload: JSON.stringify({ text: text }),
      followRedirects: false,
      muteHttpExceptions: true,
    });
  } catch (error) {
    throw new Error('Delivery unknown. Check the channel before retrying.');
  }
  if (response.getResponseCode() !== 200 || response.getContentText().trim() !== 'ok') {
    throw new Error('Webhook did not confirm delivery. HTTP ' + response.getResponseCode());
  }
}

Need a variant? Gnaw writes a custom version from one sentence — fields, triggers, edge cases handled.

Walkthrough

Which edits qualify?

On a tab named Tracker, put the status in column D and the headers in row 1. Change D7 from Open to Ready and the message reads “Tracker row 7 is ready.” The function checks the sheet that owns the edited range. Column D on Archive stays quiet.

The comparison ignores capitalization and surrounding spaces. A blank cell can become ready. Changing ready to Ready, clearing the status, or editing a header produces no message. If the item returns to Open and becomes Ready again, that later transition qualifies.

For a block edit that overlaps column D, the rule reads the edited status cells below the header and reports how many currently say Ready. A paste into C7:E9 can therefore produce one summary, including up to ten row numbers. Google supplies no prior value for each cell in a block. A row already marked Ready can appear in that summary.

In a Sheets test, pasting three rows into C8:E10 reported a 3-by-3 edit without value or oldValue. With Ready, Open and Ready in the status column, the summary named rows 8 and 10. Clearing D7 and editing E12 were quiet.

Connect an authorized Slack channel

Once you have checked the preview, enable incoming webhooks for your Slack app and authorize the intended channel. Copy its private webhook URL into Apps Script under Project Settings → Script properties. Use SLACK_WEBHOOK_URL for the property name. Keep the URL out of source code and logs, and limit project edit access to trusted maintainers.

In the tracker spreadsheet, open Extensions → Apps Script, paste the script and save. Open Triggers → Add Trigger. Choose notifySlackOnReady, From spreadsheet, On edit, then authorize with the account responsible for the integration. When replacing an older alert, remove its old trigger and sending function before enabling this one.

A simple onEdit callback can inspect an edit. Calling the external URL requires authorization, so delivery uses one installable trigger. It runs as the person who installed it. Check for other installed copies with the team if alerts appear twice.

Want a custom version?

Describe your sheet and the rule you want. Gnaw writes the Apps Script — fields, triggers, edge cases — in one shot.

FAQ

4 questions
Can I include the editor’s name?
The event may omit the editor identity under Google’s security rules. The creator of the trigger can also be a different person from the editor. The message includes row numbers and, for a block, a count. It leaves out editor identity and other cell contents.
Will formulas, imports or another script trigger alerts?
This recipe listens for a person editing a cell. Formula recalculations, script writes and API updates can change displayed values without supplying an edit event for the changed status. For those updates, arrange a separate comparison at the source.
What if Slack does not confirm delivery?
Check Apps Script Executions and the authorized channel. The handler makes one request per qualifying callback. A timeout can leave delivery uncertain. A repeat callback can also create another message. Check what arrived before deciding whether to retry.
How do I change the tracker tab or Slack channel?
Change the tab name checked by trackerReadyMessage to match your tab exactly. To change the destination, authorize a webhook for the desired Slack channel and update the script property.