0

I thought this would be simple, but I can't figure it out.

If someone types "completed" into A1, I want it to send an email to a specific email address.

Initially I set up a "completed" button, but it doesn't work on mobile. So I now just need it to send me an email when someone types in the word "completed".

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
Chris Norris
  • 197
  • 1
  • 2
  • 13

1 Answers1

1

The operation of an installable edit trigger function for sending an email is described in this answer. You simply need to tweak that function to focus on the cell or range you're interested in, and have it build & send the email you want.

function installableOnEdit( e ) {
  if (!e) throw new Error( "Need event parameter." ); // see https://stackoverflow.com/a/16089067

  var changedCell = e.range;
  var row = changedCell.getRow();
  var col = changedCell.getColumn();

  // check if change was in A1
  if (row===1 && col===1
      && e.value.toString().match(/completed/i)) // case-insensitive check

    var recipient = Session.getActiveUser().getEmail();  // send to owner
    MailApp.sendEmail( recipient, "Task Completed", "Cell A1 says: "+e.value );

  }
}
Community
  • 1
  • 1
Mogsdad
  • 44,709
  • 21
  • 151
  • 275