1

I have a Google Sheets script that's designed to input timestamps whenever there is an edit, but I need it to run on multiple sheets (West, East AND North) on the same drive... How can I make that work?

See the code below:

function onEdit(e) {
  var ss = SpreadsheetApp.getActiveSheet();
  var r = ss.getActiveCell();
  //1.Change 'Sheet1' to be matching your sheet name
  if (r.getColumn() < 9 && ss.getName()=='WEST') { // 2. If Edit is done in any column before Column (L)  And sheet name is WEST then:    
var celladdress ='L'+ r.getRowIndex() 
    ss.getRange(celladdress).setValue(new Date()).setNumberFormat("MM/dd/yyyy hh:mm");
  }
};

1 Answer 1

1

Try replacing one line of your code with this

if (r.getColumn() < 9 && ( ss.getName()=='WEST' || ss.getName()=='EAST' || ss.getName()=='NORTH' || ss.getName()=='SOUTH' ) ) {

It's a bit long, but it follows your current logic.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.