Nuevamente, no soy muy hábil con los scripts de Google, sin embargo, he tenido mucho apoyo aquí, por lo que agradecería cualquier orientación.
Me gustaría poder recordarle a un destinatario que un proceso debe actualizarse en una fecha determinada. Idealmente, me gustaría que se envíe un recordatorio 1 mes antes y luego nuevamente 1 semana antes de que el proceso deba revisarse.
Me gustaría poder enviar un correo electrónico genérico cuyas únicas variables serían el nombre del destinatario, la dirección de correo electrónico, la fecha de vencimiento y el nombre del proceso.
Cualquier idea sobre cómo podría hacer esto o cualquier tutorial que funcione. He adjuntado el enlace a la hoja de google en la que se deben activar los correos electrónicos.
https://docs.google.com/spreadsheets/d/1Qw8WefbVkS-AQXi1CcZ0z2CL-P0oNSZYqeT40oVF6go/edit?usp=sharing
Te dejo personalizar el texto...
function reminder() { var sh = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet() var data = sh.getDataRange().getValues() var d = new Date().getTime(); for (var i=1;i<data.length;i++){ if (data[i][4]<=new Date(d+7*24*60*60*1000) && data[i][4]>=new Date(d+5*24*60*60*1000) && data[i][6]!=''){ MailApp.sendEmail({to:data[i][3], subject: 'reminder ... week', htmlBody: 'Hello '+data[i][1]+' The process for '+data[i][0]+' is due to review on '+data[i][4]+' Please review the content and contact the process team before its due date if amendments are required' }) sh.getRange(i+1,7).setValue('sent') } else if (data[i][4]<=new Date(d+30*24*60*60*1000) && data[i][4]>=new Date(d+28*24*60*60*1000) && data[i][5]!=''){ MailApp.sendEmail({to:data[i][3], subject: 'reminer ... month', htmlBody: 'Hello '+data[i][1]+' The process for '+data[i][0]+' is due to review on '+data[i][4]+' Please review the content and contact the process team before its due date if amendments are required' }) sh.getRange(i+1,6).setValue('sent') } } }Entonces pon un gatillo a diario