javascript - Prevent input from being edited in Google Sheets -
how prevent timstamp being edited user has editing permisions on sheet. have sheet inputs date , time in 1 column after column edited, know if posible permit other users see date in column b when edit column after date set make no 1 can edit or erase it, column entry time recorded.
thanks in advance.
ps: using code
function onedit(event) { var timezone = "gmt-04:00"; var timezone2 = "gmt-04:00"; var timezone3 = "gmt-04:00"; var timestamp_format = "mm-dd-yyyy hh:mm:ss"; // timestamp 12hour format var timestamp_format2 = "mm-dd-yyyy hh:mm:ss"; // timestamp 12hour format var timestamp_format3 = "mm-dd-yyyy hh:mm:ss"; // timestamp 12hour format var updatecolname = "cantidad"; var timestampcolname = "solicitado" var updatecolname2 = "cantidad ordenado"; var timestampcolname2 = "fecha ordenado" var updatecolname3 = "cantidad entregada"; var timestampcolname3 = "fecha de entrega" var sheet = event.source.getactivesheet(); //name of sheet want run script. var actrng = event.source.getactiverange(); var editcolumn = actrng.getcolumn(); var index = actrng.getrowindex(); var headers = sheet.getrange(1, 1, 1, sheet.getlastcolumn()).getvalues(); var datecol = headers[0].indexof(timestampcolname); var updatecol = headers[0].indexof(updatecolname); updatecol = updatecol+1; if (datecol > -1 && index > 1 && editcolumn == updatecol) { // timestamp if 'last updated' header exists, not in header row itself! var cell = sheet.getrange(index, datecol + 1); var date = utilities.formatdate(new date(), timezone, timestamp_format); cell.setvalue(date); }
Comments
Post a Comment