I have an Event Scheduler spreadsheet where I need to add or remove employee's from column A in the query table, for each row I have a dropdown list to select names.I use a script that can find only one name at a time on the database sheet and replace it after clicking a buttom. The search engine is based on IDs (column A). I need this function to be able to get multiple names and replace them all at once instead. Can anyone help me please? This is the code I have for only one value.
function saveRecord7() {
const ss = SpreadsheetApp.getActiveSpreadsheet()
const formWS = ss.getSheetByName('Dashboard')
const dataWS = ss.getSheetByName('Static_VDatabase_UID')
const idCell = formWS.getRange('G7')
const fieldRange =["AB7"]
const clearcell = formWS.getRange('AB7')
const id = idCell.getValue()
if(id== ''){
//createNewRecord()
return
}
const cellFound = dataWS.getRange("A:A")
.createTextFinder(id)
.matchCase(true)
.matchEntireCell(true)
.findNext()
if(!cellFound) return
const row = cellFound.getRow()
const fieldValues = fieldRange.map(f => formWS.getRange(f).getValue())
fieldValues.unshift()
dataWS.getRange(row,20,1,fieldValues.length).setValues([fieldValues])
clearcell.clearContent();
}