Google apps script 打开HTML web应用程序时运行多个脚本

Google apps script 打开HTML web应用程序时运行多个脚本,google-apps-script,Google Apps Script,如何在打开HTML web应用程序时运行多个脚本 下面是我的示例脚本,当用户打开HTML web应用程序时,第二个(函数getMail)脚本应该运行并在定义的工作表中捕获电子邮件id 函数doGet(){ 返回HtmlService .createTemplateFromFile('索引') .evaluate().setSandboxMode(HtmlService.SandboxMode.IFRAME); 返回html; } 函数getMail(){ Logger.log(Session.

如何在打开HTML web应用程序时运行多个脚本

下面是我的示例脚本,当用户打开HTML web应用程序时,第二个(函数getMail)脚本应该运行并在定义的工作表中捕获电子邮件id

函数doGet(){
返回HtmlService
.createTemplateFromFile('索引')
.evaluate().setSandboxMode(HtmlService.SandboxMode.IFRAME);
返回html;
}
函数getMail(){
Logger.log(Session.getActiveUser().getEmail());
var value=Logger.getLog();
var ss=SpreadsheetApp.openById(“1irpizjkdc50dz99hyhouvubuwhzi4ngdekbc2qwqs8”).getActiveSheet();
ss.getRange(ss.getLastRow()+1,1).setValue(value);
}
函数getData(){
返回电子表格应用程序
.openById('1P0Z_njzrwjiPHrynDW37OTjwaPPFvntpiyBYSNBXt40')
.getDataRange()
.getValues();

}
您可以使用以下语法从
index.html
模板调用Google Apps脚本函数
getMail

<? getMail() ?>


详细文档:

您可以使用下一个语法从
index.html
模板调用Google Apps脚本函数
getMail

<? getMail() ?>

详细文件: