The script below gets exactly the values I am interested in from the active row of my Google Sheet. These values that I am interested in are:
firstName
LastName
emailAddress
schoolName
nativeLanguage
I collect these values to display them in an html-form with a client-side javascript. And so far, there is no problem at all to do these 2 things (so, collect values of the active row and display them in the html-form to the user).
Where I am stuck and needs help with is this:
I want the user to be able to change/replace these values in the html-form, where he sees them. And as soon as the user is done making these changes in the html-form and click on the SEND-button at the bottom of the html-form, I want these new data/input from the user to replace the initial values of the active row in my Google sheet.
Any help or hint would be great, as this other post here basically deals with the first part of my issue that´s already been solved (display cell values in sidebar).
Here is the server-side script collecting the values of the active row, and it´s been working just fine. All I would like to do now is build something on top of this, so that incoming input from the html-form can replace the values of the active/currently selected row.
function getValuesOfActiveRow() {
var s = SpreadsheetApp.getActiveSpreadsheet();
var sheet = s.getSheetByName('SHEET_NAME');
var rowIndex = sheet.getCurrentCell().getRow();
var targetRowValues = sheet.getRange(rowIndex, 1, 1, sheet.getLastColumn()).getValues()[0];
// extract relevant values from active/selected row
var relevantData = [[]]; // array of array
relevantData.push(targetRowValues);
var firstName = relevantData[1][1];
var lastName = relevantData[1][2];
var emailAddress = relevantData[1][0];
var schoolName = relevantData[1][4];
var nativeLanguage = relevantData[1][5];
return [firstName, lastName, emailAddress, schoolName, nativeLanguage];
}