我正在尝试创建一个从.gs到Web应用程序的消息框,我尝试了这些,但是消息框无法显示:
var html = HtmlService.createHtmlOutputFromFile('View');
SpreadsheetApp.getUi().showModalDialog(html, 'Dialog title');
Browser.msgBox('Hello!', Browser.Buttons.OK);
HtmlService.createHtmlOutput("Hello!");
这些方法是否正确?您的回复将不胜感激:)
示例:
Code.js
function doGet() {
return HtmlService.createHtmlOutputFromFile("index");
}
function called(){
Logger.log("I was called");
//the rest of your code
}
index.html
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<script>
if (confirm("Please confirm, are you sure you want to continue?")) {
alert( "google.script.run will be called");
google.script.run.called();
} else {
alert( "You cancelled!");
}
</script>
</body>
</html>