Description
I've put together a sample dialog and script that will get the scores and place them in a spreadsheet.
HTML_Score.html
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<div class="row" style="margin-bottom:8px">
<div class="col-10">
<p>1. Question no 1. Rate from 1 -5</p>
</div>
<div class="col-2">
<select id="1_kscore" class="form-control kscore" name="Value[]" style="font-size:8pt">
<option selected>NA</option>
<? for(var i = 0; i < dd_score.length; i++) { ?>
<option value="<?= dd_score[i] ?>" ><?= dd_score[i] ?></option>
<? } ?>
</select>
</div>
</div> <!--- close row -->
<div class="row" style="margin-bottom:8px">
<div class="col-10">
<p>2. Question no 2. Rate from 1 -5 </p>
</div>
<div class="col-2">
<select id="2_kscore" class="form-control kscore" name="Value[]" style="font-size:8pt">
<option selected>NA</option>
<? for(var i = 0; i < dd_score.length; i++) { ?>
<option value="<?= dd_score[i] ?>" ><?= dd_score[i] ?></option>
<? } ?>
</select>
</div>
</div> <!--- close row -->
<div class="row" style="margin-bottom:8px">
<div class="col-10">
<p>2. Question no 3. Rate from 1 -5 </p>
</div>
<div class="col-2">
<select id="2_kscore" class="form-control kscore" name="Value[]" style="font-size:8pt">
<option selected>NA</option>
<? for(var i = 0; i < dd_score.length; i++) { ?>
<option value="<?= dd_score[i] ?>" ><?= dd_score[i] ?></option>
<? } ?>
</select>
</div>
</div> <!--- close row -->
<div class="row" style="margin-bottom:8px">
<div class="col-10">
<p>2. Question no 4. Rate from 1 -5 </p>
</div>
<div class="col-2">
<select id="2_kscore" class="form-control kscore" name="Value[]" style="font-size:8pt">
<option selected>NA</option>
<? for(var i = 0; i < dd_score.length; i++) { ?>
<option value="<?= dd_score[i] ?>" ><?= dd_score[i] ?></option>
<? } ?>
</select>
</div>
</div> <!--- close row -->
<div class="row" style="margin-bottom:8px">
<div class="col-10">
<p>2. Question no 5. Rate from 1 -5 </p>
</div>
<div class="col-2">
<select id="2_kscore" class="form-control kscore" name="Value[]" style="font-size:8pt">
<option selected>NA</option>
<? for(var i = 0; i < dd_score.length; i++) { ?>
<option value="<?= dd_score[i] ?>" ><?= dd_score[i] ?></option>
<? } ?>
</select>
</div>
</div> <!--- close row -->
<div>
<input type="button" value="Submit" onclick="submit()">
</div>
<?!= include('JS_Score'); ?>
</body>
</html>
JS_Score.html
<script>
function submit() {
try {
let scores = document.getElementsByClassName("kscore");
let values = [];
for( let i=0; i<scores.length; i++ ) {
values.push([scores[i].value]);
}
google.script.run.writeArray(values);
}
catch(err) {
alert(err);
}
}
</script>
Code.gs
function include(filename) {
return HtmlService.createHtmlOutputFromFile(filename)
.getContent();
}
function showTest() {
let sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1")
let dd_score = sheet.getRange(1,1,5,1).getValues().flat();
var html = HtmlService.createTemplateFromFile("HTML_Score");
html.dd_score = dd_score;
SpreadsheetApp.getUi().showModalDialog(html.evaluate(),"Test");
}
function writeArray(scores) {
try {
let sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1")
sheet.getRange(1,3,5,1).setValues(scores); // Put in column C
}
catch(err) {
Logger.log(err);
}
}
Dialog


Modified scripts for comments below:
<script>
function submit() {
try {
let scores = document.getElementsByClassName("kscore");
let values = [];
for( let i=0; i<scores.length; i++ ) {
values.push(scores[i].value); // <- create a row
}
google.script.run.writeArray(values);
}
catch(err) {
alert(err);
}
}
</script>
function writeArray(scores) {
try {
let sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1")
sheet.getRange(sheet.getLastRow()+1,1,1,5).setValues([scores]); // Put in range An:En (n = new row)
}
catch(err) {
Logger.log(err);
}
}
writeArrayin a loop? You have no way of knowing in which order they are executed in sheet.google.script.runis an asynchronous process.