Script Stopped Working

26 views
Skip to first unread message

Kyle J Pangman

unread,
Nov 22, 2021, 9:12:05 AM11/22/21
to Google Apps Script Community
Good Morning All,

I wrote a script a year and a half/ two years ago.  Recently it began to hiccup and now has stopped working completely.  I have tried a few things myself but I am a dabbler at best with script.


function onEdit(event) {

var ss = SpreadsheetApp.getActiveSpreadsheet();
  var s = event.source.getActiveSheet();
  var r = event.source.getActiveRange();

  if(s.getName() == "SHEET_A" && r.getColumn() == 20 && r.getValue() == "SENT") {
    var row = r.getRow();
    var numColumns = s.getLastColumn();
    var targetSheet = ss.getSheetByName("SHEET_B");
    var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
    s.getRange(row, 1, 1, numColumns).moveTo(target);
    s.deleteRow(row);
  }
}

When SENT is typed, full caps, into the 20th column the row is moved from SHEET_A to SHEET_B.  I use this same script on another one of our sheets and it still works with out an issue.  Please help me correct any errors I may have introduced or shoot me an explanation on why this started to occur.

I apologize in advance if this has been asked, I did a search and did not find a conversation along these lines.  Thank you for everyone's help!

Andrew Roberts

unread,
Nov 22, 2021, 2:54:42 PM11/22/21
to google-apps-sc...@googlegroups.com
I'd log the whole event and see if its format has changed.

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/cc35dce2-e18c-49e8-927b-131e5d79f83fn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages