I'm very very new to scripting in general, so please bear with me.
I am testing some scripts on google sheets, running an HTML template.
Part of my script requires calling on array data. I am testing running this script: http://jsfiddle.net/nExgJ/
You will see that the script runs as desired.
However, when the HTML template launches from Google Sheets, even with the same code, the numbers are not populated.
In Google Sheets script, the following function is used to run the HTML template:
var htmlDlg = HtmlService.createHtmlOutputFromFile('index')
.setSandboxMode(HtmlService.SandboxMode.IFRAME)
.setWidth(500)
.setHeight(150);
SpreadsheetApp.getUi()
.showModalDialog(htmlDlg, 'Select An Existing Client');
}
I also have a doGet function in place, which is as follows:
function doGet() {
var htmlOutput = template.evaluate()
.setSandboxMode(HtmlService.SandboxMode.NATIVE);
return htmlOutput;
return HtmlService.createHtmlOutputFromFile('index');
}
Then the code in my HTML form is as follows:
<!DOCTYPE html>
<html>
<head>
<script>
// Get dropdown element from DOM
var dropdown = document.getElementById("selectNumber");
// Loop through the array
for (var i = 0; i < myArray.length; ++i) {
// Append the element to the end of Array list
dropdown[dropdown.length] = new Option(myArray[i], myArray[i]);
}
</script>
</head>
<body>
<form id="myForm">
<select id="selectNumber">
<option>Choose a number</option>
</select>
</form>
</body>
</html>
the actual result when code is run
Any help would be greatly appreciated. Thanks!