0

How can I make this trigger every time I make any edit to my Google Sheet?

function addNote() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheets()[0];
  var targetCell = sheet.getRange("A1");
  var sourceCell = sheet.getRange("Setup & Statements!B1");

  var noteText = sourceCell.getValue();

  targetCell.setNote(noteText);
} 
2
  • 1
    Welcome. Perhaps I am missing something more obvious here but... doesn't the title of your question provide its own answer? Create an onEdit trigger. – Tedinoz Mar 28 at 18:37
  • By "this trigger" you mean "this function", right? Have you already read developers.google.com/apps-script/guides/triggers? – Rubén Mar 28 at 22:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.