Situation:
I have a spreadsheet with 10 sheets and 15 users logging in and modifying it.
Script Function:
When someone modify any row in any column, this script will update the lastcolumn with DateTime and insert a comment with the user who made that modification.
Problem:
(1) Performance Issue: This script run when the user modify any Column. This cause maybe when I have more > 3 user logged the spreadsheet turn slowly to save.
(2) This script should be run only when some specific's columns are modify. For ej.: If the activeuser modify the column A,B,C;D,E & I the script update the lastcolumn J with the Date&Time; but if the activeuser modify the column F,G,H the script should be not run.
Test Case:
(1) This script is running OnEdit very well but is updating the lastcoulmn when someone modify anyrow in any column.
I will appreciate if anyone can help me to modify this script for only run when specific columns are modified.
Script:
function onEdit(event)
{
var ss = SpreadsheetApp.getActiveSpreadsheet();
//Script Last Update Timming
var actSht = event.source.getActiveSheet();
var actRng = event.source.getActiveRange();
var index = actRng.getRowIndex();
var dateCol = actSht.getLastColumn();
var lastCell = actSht.getRange(index,dateCol);
var date = Utilities.formatDate(new Date(), "GMT-3", "dd/MM/yyyy HH:mm");
// Note: Insert the Date when someone update the row in the last coulmn
lastCell.setValue(date);
// Nota: Insert a comment in the lastCell with the user who modify that row
lastCell.setComment(Session.getEffectiveUser());
}