dimanche 25 septembre 2022

Google Sheets, pop up message based on cell value TRUE/FALSE

I am trying to get Google Sheets show a popup message whenever a cell changes from FALSE to TRUE. I have found a few ways of doing it using onEdit functions. The problem here is that the Cell in question does not really get edited, but rather changes value due to another set of cells meeting certain criteria. That means onEdit functions won't run when the value changes.

I tried this script, but it does nothing:

//popup message
function alertMessageYesNoButton() {
  var result = SpreadsheetApp.getUi().alert("Are you sure you want to send an alert about?", SpreadsheetApp.getUi().ButtonSet.YES_NO);
  SpreadsheetApp.getActive().toast(result);
}

function sendMessageYesNo(e){
  var sheet = SpreadsheetApp.getActive().getSheetByName('Sheet1');
  var cellValue = sheet.getRange(4, 17).getValue();

  if (cellValue == 'TRUE'){
    alertMessageYesNoButton();
  }else{}
}

If someone could come up with something that works, I would really appreciate it.




Aucun commentaire:

Enregistrer un commentaire