Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function onEdit(e) {
- var s = e.source.getActiveSheet();
- var row = e.range.getRow();
- var col = e.range.getColumn();
- var offsetCol = (col == 2) ? 11 : 12
- var offsetValues = e.source.getActiveSheet().getRange(row, col, 1, 2).offset(0, offsetCol).getValues()
- var curDate = Utilities.formatDate(new Date(), "GMT-5", "dd MMM yyyy")
- var curTime = Utilities.formatDate(new Date(), "GMT-5", "HH:mm")
- console.log(offsetValues[0][0], offsetValues[0][1])
- console.log(s.getRange(row, col, 1, 2).offset(0, offsetCol).getA1Notation())
- console.log(offsetValues == ["", ""])
- if (s.getName() == "Input" && row >= 2 && (col == 2 || col == 3) && e.value == "TRUE" && offsetValues[0][0] == "" && offsetValues[0][1] == "") {
- s.getRange(row, col, 1, 2).offset(0, offsetCol).setValues([[curDate, curTime]]);
- }
- else return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement