function onEdit(e) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
if( sheet.getSheetName() != 'Sheet1' ) {
return 0;
}
var selectedCell = ss.getActiveCell();
if( selectedCell.getColumn() == 1) {
var dateTimeCell = selectedCell.offset(0, 2);
dateTimeCell.setValue('auto');
GmailApp.sendEmail('12345@gmail.com', selectedCell.getRow(), 'hello')
}
if I modify column A and run script, Gmail sent. but if I modify column A only (don't run code), then Gmail not sent. 'auto' is inserted in both case. I suspect only GmailApp.sendEmail is not working.
why?
Do you have a trigger set up for it? The function you have only shows a simple trigger onEdit()
which cannot send emails. See Restrictions here.
Vytautas is right. It says that:
They cannot access services that require authorization. For example, a simple trigger cannot send an email because the Gmail service requires authorization, but a simple trigger can translate a phrase with the Language service, which is anonymous.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.