В настоящее время используется функция скрипта приложения ниже, чтобы обновить один столбец данных в одном разделе моей формы Google. Тем не менее, я хочу написать код, где я могу обновить несколько строк данных в нескольких разделах формы Google.
Пример: обновление столбца 1 до раздела 1, обновление столбца 2 до раздела 2 и т. Д. c ..
Google Sheet - имена сотрудников
function updateForm(){
// call your form and connect to the drop-down item
var form = FormApp.openById("Form Id");
var namesList = form.getItemById("Dropdown List ID").asListItem();
// identify the sheet where the data resides needed to populate the drop-down
var ss = SpreadsheetApp.getActive();
var names = ss.getSheetByName("Sheet Name");
// grab the values in the first column of the sheet - use 2 to skip header row
var namesValues = names.getRange(2, 10, names.getMaxRows() - 1).getValues();
var shopperNames = [];
// convert the array ignoring empty cells
for(var i = 0; i < namesValues.length; i++)
if(namesValues[i][0] != "")
shopperNames[i] = namesValues[i][0];
// populate the drop-down with the array data
namesList.setChoiceValues(shopperNames);
}