Reputation: 97
I've got three files that does one simple thing:
That's it. But...the alert gets displayed TWICE. Here is the code:
custom-menu.gs
function onOpen() {
SpreadsheetApp.getUi().createMenu('custom menu')
.addItem('button 1','someFunction')
.addToUi();
}
gas-file.gs
function someFunction() {
const htmlOutput = HtmlService.createHtmlOutputFromFile("html-file");
SpreadsheetApp.getUi().showModalDialog(htmlOutput, "Some Title");
}
function someFunc1() {
SpreadsheetApp.getUi().alert("someFunc1() has been called.")
}
html-file.html
<!DOCTYPE html>
<html>
<body>
<button type="button" onclick="submit()">Submit</button>
<script>
function submit() {
google.script.run.someFunc1();
}
</script>
</body>
</html>
I'm completely baffled. Any help would be greatly appreciated. Thank you in advance!
Upvotes: 0
Views: 51