Tag Info

New answers tagged

1

See if this helps ? function onEdit(e) { var s = e.source.getActiveSheet(), watchCols = [2, 5], offsetCol = [8, 10], ind = watchCols.indexOf(e.range.columnStart) if (s.getName() !== "Sheet1" || ind === -1) return; e.range.offset(0, offsetCol[ind]) .setValue(!e.value ? null : Utilities.formatDate(new Date(), "GMT", "hh:mm")) }


1

First, the error: shs is an array, since you populate it with ss.getSheets(), so it doesn't have a method getActiveCell(). However, the elements of the array has that method. You are also referencing a variable sheet, which you haven't defined anywhere. Currently, your code is more suitable for going through a single sheet, you need to iterate through the ...


0

You need to send HTML email to do that. In Google Apps Script you do that by specifying a htmlBody element to the MailApp.sendMessage method: MailApp.sendEmail({ to: "recipient@example.com", subject: "Your link", htmlBody: "Here is your example link: " + "<a ...


0

Perhaps you can format it the way you want by using this in the first place. Code var start = row[5]; // "Fri Feb 20 2015 00:00:00 GMT+0200 (SAST)" var newStart = Utilities.formatDate(new Date(start), "SAST", "EEE MMM d yyyy"); Logger.log(newStart); Screenshot


1

Have you tried the .toDateString() method ? See what this gives you: var start = row[5]; var dateStr = start.toDateString(); Logger.log(dateStr)


0

You're basically wanting to format a date. I would act on the JavaScript Date object, something like: var startDate = new Date(row[5]); var weekDay; switch (startDate.getDay()) { case 0: weekDay = "Sun"; break; case 1: weekDay = "Mon"; break; case 2: weekDay = "Tue"; break; case 3: weekDay = "Wed"; break; case 4: weekDay = "Thu"; break; case 5: ...


0

This piece of code does the same. Code function getPastweeks(weeks) { var cDate = new Date(); return new Date(cDate.getTime() - getMs(weeks) - getCorr(cDate.getDay())); } function getCorr(day) { var corr; if(day >= 1) { corr = getMs((day - 1)); } else { corr = getMs(6); } return corr/7; } function getMs(value) { return value * ...


1

You can go to Tools -> Script editor, copy the code and paste it inside the Script editor of your other form.


0

Just replace eventRange.getLastColum() + 1 with a number. Column A is 1, B is 2 etc. So if you want the ID to be placed in column C, change the code to var column = 3;


1

Change this var date = Utilities.formatDate(new Date(), "GMT", "ddMMMyyyy"); into this var date = Utilities.formatDate(new Date(), "GMT", "ddMMMyyyy").toUpperCase(); ht to Chris



Top 50 recent answers are included