I am trying to populate my HTML Service drop down/select option list with all entries included in column A of my Vendor Database tab in the Google Sheet I am working with. It is currently showing up blank, though, when running. Any suggestions?
APPS SCRIPT:
function getVendors() {
var active = SpreadsheetApp.getActive();
var sheet = active.getSheetByName("Vendor Database");
var lastRow = sheet.getLastRow();
var myRange = sheet.getRange("A2:A" + lastRow);
var data = myRange.getValues();
var optionsHTML += "";
for (var i = 0; i < data.length;i+=1) {
optionsHTML = '<option>' + data[i][0] + '</option>';
};
return optionsHTML;
}
HTML:
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<form>
<div>
<select>
<option> != google.script.run.getVendors(); </option>
</select>
</div>
</form>
</body>
</html>