I want to apply the script below to only the sheet called "Analyses"

function onEdit() { 
    var sheetName = "Analyses";
    var s = SpreadsheetApp.getActiveSheet(); // Get spreadsheet name 
    var r = s.getActiveCell(); // store active cell name in current spreadsheet 
  var cell1 = 6 // This is the column I want to put values
  if(r.getColumn() != cell1) { // Ignores this row (where I put the dates)
    var row = r.getRow();  // Get column # from active cell
    var time = new Date(); // Get date and time of last mod
    time = Utilities.formatDate(time, "GMT+05:30", "MM/dd/yyyy"); // Format date and time
    SpreadsheetApp.getActiveSheet().getRange('F' + row.toString()).setValue(time); // put in time in cell

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.