누구든지 도움을 줄 수 있습니다. 간단한 Google 스프레드 시트를 통해 대리인을 다른 장소 및 시간과 날짜에 다양한 강좌에 예약 할 수 있습니다. 작년에 Bob Rashkin이 친절하게 설정 한 스프레드 시트를 사용했습니다! 참석자가 코스에 예약했을 때 완벽하게 작동하고 이메일을 보냈습니다. 코스가 시작된 지 9 일이되었을 때 자동으로 이메일 알리미를 보냈습니다.이메일을 보내면 Google이 확산되는 시간을 알려줍니다
나는이 용어에 대한 스프레드 시트를 복제했지만 시트가 미리 알림 전자 메일을 보내지 않기 때문에이 문제에 대한 약간의 도움이 될 수 있습니까?
두 번째 문제는 스크립트가 예약 확인 이메일을 보내면 두 번 예약하여 두 번 예약했는지 묻는 전화가 많이 걸리는 경우입니다.
도움말 사람하시기 바랍니다
이 내가
function Reminder() {
var ss=SpreadsheetApp.getActiveSpreadsheet();
var s=ss.getActiveSheet();
var r1=s.getDataRange().getRow()+1;//Start past the header row!!! Doh!
var r2=s.getDataRange().getLastRow();
var mn,m,days,d=new Date(),coursedate=new Date(),dlen=8.64e7,i,course,r,year;//8.64e7
var subject="Just a gentle reminder that you or colleague(s) from your setting have a Paediatric First Aid course coming up in the next week or so. ";
var recipient, body, tail="Please be aware that Entrust (formerly Staffs Early Years) will make a charge for non attendance so";
tail+=" please make sure that you familiarise yourself with the times and dates of the course. ";
tail+="If you need help finding the venue then please follow the link below to find the venue and print off a map if required.";
tail+="\n\nhttp://www.blithfieldsafety.co.uk/venues/";
for (r=r1;r<=r2;r++) {
recipient=s.getRange(r,9).getValue();
course=s.getRange(r, 2).getValue();
body=subject+"\nCourse Details\n"+course+"\n\nDelegate Name: "+s.getRange(r,4).getValue()+"\n\n"+tail; //changed (r,2) to (r,4)
mn=course.match(/Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec/)[0];
m=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"].indexOf(mn);
days=course.match(/(\d{1,2})(st|nd|rd|th)/g);
year=d.getFullYear();
for (i in days) {
coursedate.setMonth(m);
coursedate.setDate(days[i].slice(0,-2));
if ((coursedate-d)/dlen<14 && s.getRange(r,16).getValue()!="mail sent") {
GmailApp.sendEmail(recipient, subject, body);
s.getRange(r,16).setValue("mail sent");//arbitrarily picked col 15
}
}
}
};
86400000 밀리 초는 밀리 초 단위의 하루입니다.이는 현재 14 일 전과 메일이 발송되지 않은 경우에 해당 조건이 적용됨을 의미합니다. –
감사합니다. 따라서 밀리 초 단위로 나눠지기 때문에''(coursedate-d) '는 밀리 초 단위의 일이어야한다고 가정합니다. DaysInMilliseconds/Milliseconds = 일. 그러므로,'coursedate'와'd' 변수는 밀리 세컨드 단위 여야합니다. 현재 날짜로'coursedate'와'd'가 시작됩니다 :'d = new Date(), coursedate = new Date()','coursedate'가 변경됩니다. 스프레드 시트에서 무엇이 검색되는지 알지 못하면 문제는 무엇인지 추측 할 수 있습니다. –
나는 coursedate가 새로운 Date(). getTime()으로 정의되어야한다고 생각한다. 빼기가 두 조건 모두에서 밀리 초를 사용하여 이루어 졌는지 확인해야한다. 그러나 나는 코드를 테스트하지 않았으므로 확신 할 수 없습니다. 단지 제안입니다. –