I have an html form where the client's data is inserted in and it appends row with the values on to a google sheet.
In the form, there's a field that searches and returns the clients data when searching for a specific value (id number).
function getID(IDsearch){
var ws = SpreadsheetApp.getActiveSheet();
var data = ws.getRange(3, 1, ws.getLastRow(), 36).getValues();
var dataInput = data.map(function(r){return r[7];});
var position = dataInput.indexOf(IDsearch);
var dataArray = ws.getRange(position+3, 1, 1, 36).getValues();
if(position > -1){
return dataArray;
} else {
return position;
}
}
After this runs, all the input fields in the form are populated with the data from that row. I need to edit the values in the form and when submit it should overwrite/update the existing row with that id number.
In google sheets documentation, I've found the spreadsheets.values.update method, but I cannot figure this out. I'm pretty new in this and any help would be appreciated.
Thanks everyone!
getIDyou expect? - TanaikeI need to edit the values in the form and when submit it should overwrite/update the existing row with that id number.. About this, I have to apologize for my poor English skill. - Tanaikewhat I need is to be able to save the editing done in the form to that data. Currently, whenever I submit the form with the edited data, it creates a new row with the same ID. I need to edit the row and not create a new one., I cannot image the vision of it. In your case, should you show the form script instead of your current script in your question? - Tanaike