Sidebar
function onOpen() { var ui = SpreadsheetApp.getUi(); ui.createMenu('Menu') .addItem('Show text', 'showSidebar') .addItem('Edit text', 'openUrl') .addToUi(); } function showSidebar(){ var cell = SpreadsheetApp.getActiveSheet().getActiveCell(); var html = HtmlService.createHtmlOutput(cell.getDisplayValue()) .setTitle("Detail") .setWidth(1000); SpreadsheetApp.getUi().showSidebar(html); }; function openUrl() { var url = "https://wordtohtml.net/site/index"; var html = "<script>window.open('" + url + "');google.script.host.close();</script>"; var userInterface = HtmlService.createHtmlOutput(html); SpreadsheetApp.getUi().showModalDialog(userInterface, 'Edit description') }
Google Forms Edit link
Generate the Edit link on Submit when the sheet is connected to a Google forms. The source of the script is here
// Form URL var formURL = 'https://docs.google.com/forms/d/1sxjG3HH91m51HLf2EJhBnjt3ojQsyfVOz9tw4QrwgRQ/viewform'; // Sheet name used as destination of the form responses var sheetName = 'timeline'; /* * Name of the column to be used to hold the response edit URLs * It should match exactly the header of the related column, * otherwise it will do nothing. */ var columnName = 'edit' ; // Responses starting row var startRow = 2; function getEditResponseUrls(){ var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(sheetName); var headers = sheet.getRange(1, 1, 1, sheet.getLastColumn()).getValues(); var columnIndex = headers[0].indexOf(columnName); var data = sheet.getDataRange().getValues(); var form = FormApp.openByUrl(formURL); for(var i = startRow-1; i < data.length; i++) { if(data[i][0] != '' && data[i][columnIndex] == '') { var timestamp = data[i][0]; var formSubmitted = form.getResponses(timestamp); if(formSubmitted.length < 1) continue; var editResponseUrl = formSubmitted[0].getEditResponseUrl(); sheet.getRange(i+1, columnIndex+1).setValue(editResponseUrl); } } }