Как получить оценки формы Google в сценарии, когда пользователь отправляет свои ответы
Я хочу получить в моем сценарии оценку формы Google после того, как пользователь отправит ответы.
Знаете ли вы метод в приложении, который извлекает это? Спасибо за помощь.
1 ответ
Вы можете сделать это, используя скрипт ниже.
function myFunction() {
var ss = SpreadsheetApp.getActiveSheet();
var headers = ss.getRange(1, 1, 1, ss.getLastColumn()).getValues(); // Get all the values in the header row.
var scoresCol = 0; // This var will be the index of the score column.
for(var i = 0; i < headers[0].length; i++){ // Loop to find the index of the score column and set the index in the scoresCol var.
if(headers[0][i] == 'Score'){
scoresCol = i + 1;
break;
}
}
var scores = ss.getRange(2, scoresCol, ss.getLastRow()).getValues(); // Get all values in that column.
}