Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
指定時間にGoogleCalenderをサマリーして日報雛形を作成、Evernoteにタグ付きで転送するスクリプト
function scheduleMail() {
// スケジュールトリガーで、時間主導型、8-9時、月~金曜日を設定する
// 指定時間にGoogleCalenderをサマリーして日報雛形を作成、Evernoteにタグ付きで転送する
var cal = CalendarApp.getDefaultCalendar();
var events = cal.getEventsForDay(new Date());
var honbun = "";
// Evernoteの件名の文法は [ノートの件名] ![リマインダーの日時(任意)] @[ノートブック名] #[タグ]
var kenmei = Utilities.formatDate(new Date(),"GMT+09:00","yyyy/MM/dd")+ "ワーク #朝メール #日報";
//var mailto = "your_mail@gmail.com"
var mailto = "your_evernote_mail@m.evernote.com"
if(events.length > 0){
honbun = "今日の予定" + "\n\n";
for(var i=0; i < events.length; i++){
if (!events[i].isAllDayEvent()){
honbun += Utilities.formatDate(events[i].getStartTime(),"GMT+0900","HH:mm") + "-";
honbun += Utilities.formatDate(events[i].getEndTime(),"GMT+0900","HH:mm") + ":";
} else {
honbun += "[]"
}
honbun += events[i].getTitle();
if (events[i].getLocation() != ""){
honbun += "@" + events[i].getLocation();
}
honbun += "\n"
}
} else {
honbun = "今日の予定はありません";
}
MailApp.sendEmail(mailto, kenmei, honbun);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment