Here is the script I have written. It puts a time stamp at the end of the row whenever that row is edited.
function setDate() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
//Get Active cell
var mycell = ss.getActiveSelection();
var cellcol = mycell.getColumn();
var cellrow = mycell.getRow();
//Check to see if column is A or B to trigger
if (cellcol == EDITMECOLUMN)
{
//check for row to trigger
if (cellrow == EDITMEROW)
{
//Find cell and set date in a defined cell
var celldate = sheet.getRange(EDITMEROW, EDITMECOLUMN);
celldate.setValue(new Date());
//end set date
}
}
}
It works well, but how can I change it so it iterates for each row instead of me having to copy the script for each row manually? I have a form that populates a spreadsheet, and the "latest" results from each topic in the form are put in a report spreadsheet. I need the column time stamps for each row because each row represents a topic from the form, and the form user can choose to skip sections for weeks at a time.
EDITMExx pieces are just spots where I would put column or row #.
The function is called from a onEdit() trigger