Reputation: 1
I have an email typed into field in my html file. I also have the user email captured by the Code.gs file.
I have figured out how to check to make sure these two match. However, I cannot figure out how to make a pop-up message (alert of any kind) appear on the user's screen when these do or do not match. (EX: 'user email does not match typed email' when failed and 'successful match' when it match)
if(userEmail == typedEmail){
Logger.log('Success!');
}
else{
Logger.log('Fail!');
}
I would like to add a message before Logger.log('Success!');
and Logger.log('Fail!');
The Logger.log
is working correctly.
Upvotes: 0
Views: 48
Reputation: 2774
Send an alert to the spreadsheet user if email addresses don't match.
Since I don't have the rest of your function I can't format the code too well, but this section should look something like this to achieve your goal:
var ui = SpreadsheetApp.getUi();
if(userEmail == typedEmail){
ui.alert('Successful match');
Logger.log('Success!');
}
else{
ui.alert('User email does not match with typed email');
Logger.log('Fail!');
}
We can use ui.alert()
to send an alert to the user of the spreadsheet, all you need to do is define the message inside your brackets. I copied the ones from your question as an example.
Upvotes: 1