HTML Code
<div align = 'center'style='margin-top:100px'>
<span> Country </span>
<select id="menuList">
<option selected value = ''>Select item</option>
</select>
<span id="listValue" ></span>
</div>
Javascript Code
<script>
window.addEventListener('load', function() {
option_menu()
})
const option_menu = () => {
google.script.run.withSuccessHandler(function(output){
var menu_Select = document.getElementById("menuList");
var option = document.createElement("option");
output.forEach(function(item) {
var option = document.createElement("option");
option.value = item[0];
option.text = item[0];
menu_Select.appendChild(option);
});
}).getSheetNames();
}
</script>
Code.gs
function getSheetNames() {
var output = new Array()
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheets = ss.getSheets();
for (var i=0 ; i < sheets.length ; i++) {
output.push( [ sheets[i].getName() ] )
Logger.log(output)
return output
}