I am trying to run this script in a googlesheet, but, the following erros
msg appears: Service called many times not same day; or, em
portuguese: Serviço chamado muitas vezes no mesmo dia: email. (linha 29,
arquivo "Copia_20171")
function sendEmails20171() {
var planilha2017_1 =
SpreadsheetApp.getActiveSpreadsheet().getSheetByName('2017_1');
//"Armazena" a planilha 2017 na variável 20171
var manipula2017_1 = planilha2017_1.getRange(1, 7,
planilha2017_1.getLastRow() - 1, 2).getValues(); //Configura pra pegar
linhas e colunas de planilha20171,
//armazenando-os na variável manipula20171
var colunaAssunto = planilha2017_1.getRange(1, 2,
planilha2017_1.getLastRow() - 1, 2).getValues();//pega o assunto, linha 2,
coluna 3.
var colunaSecaoResp = planilha2017_1.getRange(1, 8,
planilha2017_1.getLastRow() - 1, 2).getValues();//pega a seção, linha 2,
coluna 8.
var colunaTitularSecao = planilha2017_1.getRange(1, 10,
planilha2017_1.getLastRow() - 1, 2).getValues();//pega o titular da seção,
linha 2, coluna 10.
var nomePlanilha = planilha2017_1.getName(); //pega o nome da planilha
var email = '[email protected]';
var link2017_1 = 'https://goo.gl/xF5Nbg';
var linkCelula =
'https://docs.google.com/spreadsheets/d/1YiLCBggDIJKKPYEM2JYEwG2B4wSV3dO0NoiapNtAiM/edit?ts=561cf0ae#gid=1588829769&range=';
for (var i = 0; i < manipula2017_1.length; i++) {
if (manipula2017_1[i][1] <=300 && manipula2017_1[i][1] > -720 ) { //o
alerta dispara quando faltam menos de cinco dias para vencer e até depois
de dois
//anos vencidos - e não cumprido.
var assuntoPlanilha = colunaAssunto[2][5];// pega o assunto da
planilha
var secaoResp = colunaSecaoResp[3][5];// pega a seção responsavel
var titularSecao = colunaTitularSecao[i][1];// pega o titular da
seção.
var link2017Celula = linkCelula+[i+1]+":"+[i+1];
var dias = manipula2017_1[i][1]; //pega os dias vencidos
var assuntoEmail = secaoResp + " - \nPrazo de monitoramento em " +
'"' + nomePlanilha + '"' + " vencendo em " + dias + " dias";
MailApp.sendEmail(email, assuntoEmail, "Assunto: " + assuntoPlanilha
+ " \nSeção Responsável: " + secaoResp + " \nSeção Responsável: " +
+ "\nPara maiores detalhes, clique aqui: ");
}
}
}
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-appengine/0243a415-1db4-4cbc-8790-c798dd1e2120%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.