Script for GoogleSheets that inserts date, time, and user names of everyone entering text in a specified cell?

by µHg30   Last Updated February 17, 2018 22:03 PM

I wanted to ask for your help in building a script in Google spreadsheet that would allow users to respond to comments left by different users in the same cell (cell where the initial comment was originally posted), while having this script insert a [date, time, user name] stamp in the beginning of currently written comment. Visually the end result of that one cell would ideally look like this:

[12/07/17, 11:15am, John] has this project been submitted? 
[12/07/17, 11:19am, Steve] currently finalizing it. Will be ready in 10 minutes 
[12/07/17, 11:22am, John] thanks for the update.

A script is currently floating around which is similar, but it is very limited - a slightly edited version is in the linked spreadsheet. This spreadsheet also contains a visual example and an explanation of what I'm trying to achieve. Please take a look and let me know if any further clarification is needed.

function onOpen() {
    SpreadsheetApp.getUi().createMenu('Allow Script?')
        .addItem('Yes', 'createSpreadsheetEditTrigger')

function createSpreadsheetEditTrigger() {
    var user = Session.getActiveUser().getEmail();
    SpreadsheetApp.getUi().alert('script is now authorized by ' + user + '');

function runOnEdit(e) {
    if (e.source.getActiveSheet().getName() !== 'Sheet1' || e.range.columnStart !== 1 || !e.value) return;
    e.range.offset(0, 1, 1, 2).setValues([
        [Session.getActiveUser().getEmail().split("@")[0],new Date()]

function checkTriggers() {
    var allTriggers = ScriptApp.getProjectTriggers();
    if (allTriggers.length > 0) {
        for (var i = 0; i < allTriggers.length; i++) {

Related Questions

Avoiding an authorization request for google scripts

Updated November 23, 2018 16:03 PM

Which is better: onEdit or onChange trigger?

Updated August 14, 2018 16:03 PM