例:店舗の「日報フォーム」。各店のスタッフが閉店後に入力した内容を、翌朝7時に店長あてのメールでまとめて届けます。Google スプレッドシートと GAS(Google Apps Script)だけで動き、追加の費用はかかりません。
| A タイムスタンプ | B 店舗 | C 売上(円) | D 来店数 | E 気になったこと | |
|---|---|---|---|---|---|
| 2 | 2026/11/21 21:05 | 中央店 | 182,400 | 96 | |
| 3 | 2026/11/21 21:12 | 港店 | 124,900 | 71 | レジのレシート用紙が残りわずか |
| 4 | 2026/11/21 21:40 | 駅前店 | 210,300 | 118 |
おはようございます。11月21日(土)の日報のまとめです。 ■ 店舗ごと ・駅前店 210,300円(118人) ・中央店 182,400円(96人) ・港店 124,900円(71人) ■ 気になる報告(1件) ・港店:レジのレシート用紙が残りわずか ※ このメールは自動で送っています。日報が未提出の店舗はありません。
// 毎朝7時に動かす(トリガーで設定)。前日分の回答を集めてメールで送る function sendDailySummary() { const ss = SpreadsheetApp.getActive(); const rows = ss.getSheetByName('回答').getDataRange().getValues().slice(1); const settings = ss.getSheetByName('設定'); const to = settings.getRange('B1').getValue(); // 送り先は「設定」シートで変えられる const stores = settings.getRange('B2').getValue().split(','); const tz = 'Asia/Tokyo'; const y = new Date(); y.setDate(y.getDate() - 1); const key = Utilities.formatDate(y, tz, 'yyyy-MM-dd'); const label = Utilities.formatDate(y, tz, 'M月d日'); const daily = rows.filter(r => Utilities.formatDate(new Date(r[0]), tz, 'yyyy-MM-dd') === key); const byStore = {}; daily.forEach(([, store, sales, visitors, memo]) => { byStore[store] = byStore[store] || { sales: 0, visitors: 0, memos: [] }; byStore[store].sales += Number(sales) || 0; byStore[store].visitors += Number(visitors) || 0; if (memo) byStore[store].memos.push(memo); }); const missing = stores.filter(s => !byStore[s.trim()]); // 未提出の店も知らせる const total = Object.values(byStore).reduce((a, s) => a + s.sales, 0); const people = Object.values(byStore).reduce((a, s) => a + s.visitors, 0); ss.getSheetByName('集計').appendRow([key, total, people, missing.join('、')]); MailApp.sendEmail(to, `【日報まとめ】${label} 合計 ${total.toLocaleString()}円 / ${people}人`, buildBody(label, byStore, missing)); // 本文を組み立てる関数は省略 }