Frage

I am trying to find some way to retrieve information from the control panel in a google apps script gadget in a Google site once a user logs in to his Google account.

I found one way to run the script as the user and used the function Session.getActiveUser() and deploy it in the apps script gadget.

Did not work and an error appeared "the script worked perfectly but did not return anything."

Any solutions for this problem? Or did I miss some other good way to show the information needed?

War es hilfreich?

Lösung

As I mentioned in my comment, you are not returning an UiApp object. See Ui Service documentation for information on how to display an UI. At a very basic level you can use the following code

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;
}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top