Me and some guys here are working on an start up. We are currently using Google OpenID API to manage registration and login to our app, but we want to migrate to a easier user r
I worked out Doug's suggestion and it works. Just make sure that the (effective) user invoking the function has the right to call addViewer. A trick to accomplish this is to make sure the routine is called from a trigger routine, so the owner of the script is the effective user.
function checkIfGoogleAccount(emailAddress) {
try {
SpreadsheetApp.getActiveSpreadsheet().addViewer(emailAddress) ;
SpreadsheetApp.getActiveSpreadsheet().removeViewer(emailAddress) ;
return true ;
}
catch(err) {
return false ;
}
}