我试图找到一些方法,一旦用户登录到他的Google帐户,就可以在Google网站的Google Apps脚本小工具中从控制面板检索信息。
我找到了run the script as the user的一种方法并使用了函数Session.getActiveUser()并将其部署在apps脚本小工具中。
没有工作,出现错误“脚本运行完美,但没有返回任何内容。”
针对此问题的任何解决方案?或者我是否错过了其他一些展示所需信息的好方法?
答案 0 :(得分:1)
正如我在评论中提到的,您没有返回UiApp对象。有关如何显示UI的信息,请参阅Ui Service documentation。在最基本的级别,您可以使用以下代码
function doGet(e)
{
var app = UiApp.createApplication();
var value = logActiveUserEmail();
app.add(app.createLabel('Your email address is ' + value));
// Return the UI App
return app;
}
function logActiveUserEmail()
{
var email = Session.getActiveUser().getEmail();
Logger.log(email);
return email;
}