Our comparison of Apps Script with Office Scripts and Power Automate shows the same small job on both sides: every morning, collect yesterday's open orders and email the manager a summary. On the Google side it is one function and one trigger, about fifteen lines. I ran those fifteen lines against mocked Apps Script services with invented orders before recommending them to anyone, and the summary went wrong in four ways that none of the comparison tables would show.
Run the setup function twice and the manager gets two emails every morning. Let a second person in the team run it, and deleting old triggers does not help, because one account cannot see another account's triggers. Type the status as "open" instead of "Open" and the order disappears. And the summary that promises yesterday's open orders sends every open order there is.
The code from the comparison
This is the Google half of the Apps Script vs Office Scripts comparison. The sheet Orders has four columns: order number, customer, order date and status.
The code is two functions. morningSummary reads the whole Orders range, keeps rows where r[3] === 'Open', joins the first three columns of each into a line with a template string and sends them with MailApp.sendEmail, with "N open orders" as the subject. installTrigger, commented "run once", calls ScriptApp.newTrigger('morningSummary').timeBased().everyDays(1).atHour(7).create(). The full listing is in the comparison post.
The comparison's point stands: on Google the logic, the schedule and the email live in one file, while the Microsoft version needs an Office Script, a Power Automate flow and an Outlook connection. Fewer pieces means fewer places to break. But "fewer pieces" is not the same as "nothing to get wrong", and the four problems below are all in the one file.
What the mocked run showed
I replaced SpreadsheetApp, MailApp, ScriptApp, PropertiesService, LockService and Session with fakes that follow Google's documented behaviour, and ran the original code and the fixed code against the same invented orders:
| Input (invented orders, mocked Apps Script) | Code from the comparison | With the three blocks |
|---|---|---|
| installTrigger run twice, then one morning | 2 triggers, 2 emails | 1 trigger, 1 email |
| Two accounts each run installTrigger once | Each account sees 1 trigger, 2 emails | Each account sees 1 trigger, 1 email |
| 4 open orders typed Open, open, "Open " and OPEN | Subject: 1 open orders | Subject: 4 new, 0 older |
| 30 days of orders, 1 opened yesterday, 9 older still open | Subject: 10 open orders | Subject: 1 new, 9 older |
The first two rows are the ones that reach the manager's inbox, so they are worth explaining.
"Run once" is a comment, not a guard. installTrigger creates a new trigger every time it runs. If someone runs it again, after changing the hour, or because they were not sure the first run worked, the project now has two daily triggers and the manager gets two identical emails. Nothing in the script notices.
Deleting old triggers only reaches your own. The usual fix is to delete existing triggers before creating one. That is part of the fix below, but Google's reference for ScriptApp.getProjectTriggers() says it "gets all installable triggers associated with the current project and current user". The triggers guide adds that a given account "can't see triggers installed from a second account", and that each installable trigger runs as the account that created it. So when a colleague runs the setup from their own account, your cleanup code cannot see their trigger, both triggers fire, and two emails go out, one from each account.
The other two rows are quieter. r[3] === 'Open' is an exact match, so a status typed as "open", "OPEN" or "Open " with a trailing space is not counted. And the filter only looks at the status, so an order opened three weeks ago and never closed appears in every morning's summary, with nothing to show it is not new. With 30 days of orders and one opened yesterday, the subject says "10 open orders".
The date column has a fifth, cosmetic issue: a date cell arrives in the script as a Date object, and a template string prints it in full. In my Node run that was "Fri Nov 20 2026 00:00:00 GMT+0300" followed by the machine's time zone name in brackets, and the exact text depends on the machine, so I have not claimed what Apps Script prints. Formatting it with Utilities.formatDate removes the question.
Block 1: decide what "open" and "yesterday" mean
const COL = { ID: 0, CUSTOMER: 1, DATE: 2, STATUS: 3 }; function dayKey_(d, tz) { return Utilities.formatDate(d, tz, 'yyyy-MM-dd'); } function isDate_(v) { return Object.prototype.toString.call(v) === '[object Date]' && !isNaN(v.getTime()); } // Splits open orders into yesterday's, older ones still open, // and open rows whose date cell is not a real date. function summarise_(rows, nowMs, tz) { const yesterday = dayKey_(new Date(nowMs - 864e5), tz); const out = { yesterday, fresh: [], older: [], noDate: [] }; rows.forEach(r => { if (!r[COL.ID]) return; // blank row const status = String(r[COL.STATUS]).trim().toLowerCase(); if (status !== 'open') return; if (!isDate_(r[COL.DATE])) { out.noDate.push(r); return; } const key = dayKey_(r[COL.DATE], tz); if (key === yesterday) out.fresh.push(r); else if (key < yesterday) out.older.push(r); }); return out; } function line_(r, tz) { const d = isDate_(r[COL.DATE]) ? dayKey_(r[COL.DATE], tz) : String(r[COL.DATE]); return r[COL.ID] + ' ' + r[COL.CUSTOMER] + ' ' + d; } summarise_ splits open orders into three lists instead of one. Yesterday's orders are the ones the summary was meant to report. Older orders that are still open get their own count, because a manager reading "1 new, 9 older" knows something different from "10 open orders". The third list catches open rows whose date cell is not a real date (text such as "20/11/2026" typed into a column Sheets did not recognise as a date). Without it those rows fall out of both lists and nobody sees them.
"Yesterday" is computed in the script's time zone with Session.getScriptTimeZone(), which is the same time zone the trigger's atHour(7) uses. The ClockTriggerBuilder reference shows atHour running "between 5am-6am in the timezone of the script" for hour 5. If the script's time zone in Project Settings is not where the manager works, both the trigger time and "yesterday" move together, which is at least consistent.
Block 2: one email per day, whoever's trigger fires
const MANAGER = 'manager@yourcompany.com'; function morningSummary() { const lock = LockService.getScriptLock(); if (!lock.tryLock(30000)) return 'busy'; try { const props = PropertiesService.getScriptProperties(); const tz = Session.getScriptTimeZone(); const today = dayKey_(new Date(), tz); // Shared by every account's trigger, so only one email a day. if (props.getProperty('SUMMARY_SENT') === today) { return 'already sent'; } const rows = SpreadsheetApp.getActive() .getSheetByName('Orders') .getDataRange() .getValues() .slice(1); const s = summarise_(rows, Date.now(), tz); const parts = [ 'New on ' + s.yesterday + ' and still open:', s.fresh.map(r => line_(r, tz)).join('\n') || 'None.', '', 'Older and still open: ' + s.older.length, s.older.map(r => line_(r, tz)).join('\n') ]; if (s.noDate.length) { parts.push('', 'Open, but the date is not a date (fix these):', s.noDate.map(r => line_(r, tz)).join('\n')); } MailApp.sendEmail(MANAGER, s.fresh.length + ' new, ' + s.older.length + ' older open orders (' + s.yesterday + ')', parts.join('\n').trim()); props.setProperty('SUMMARY_SENT', today); return 'sent'; } finally { lock.releaseLock(); } } The guard is the SUMMARY_SENT script property. Script properties are shared by everyone who runs the project, unlike triggers, so it works across accounts. The first trigger to fire that morning takes the script lock, sees no date for today, sends the email and writes the date. Any later trigger that day, from the same account or a different one, finds the date and returns already sent. The lock matters because two triggers set for the same hour can run close together, and without it both could read an empty property before either writes it.
The date is written after MailApp.sendEmail succeeds, not before. If the email fails, on a quota error for example, the property stays empty and the next trigger can try again. The cost of that order is one possible duplicate if the script stops between sending and writing, which is a better failure than a summary that silently never arrives.
Block 3: a setup function you can run again
// Safe to run again: removes this account's old trigger first. // It cannot see triggers made by other accounts; the // SUMMARY_SENT check in morningSummary covers those. function installTrigger() { ScriptApp.getProjectTriggers() .filter(t => t.getHandlerFunction() === 'morningSummary') .forEach(t => ScriptApp.deleteTrigger(t)); ScriptApp.newTrigger('morningSummary') .timeBased() .everyDays(1) .atHour(7) // between 7 and 8, script time zone .create(); return 'One morningSummary trigger for ' + Session.getEffectiveUser().getEmail(); } It deletes this account's existing morningSummary triggers, and only those, before creating one. A trigger for any other function is left alone. The return value names the account, so whoever runs it sees which account now owns the schedule. If you want to know whether another account also installed one, "My Triggers" at script.google.com lists the triggers associated with the account you are signed in as, so the other person has to look at theirs.
Pitfalls
- The manager's address is in the code. Changing the recipient means editing the script. Moving it to a script property makes it a setting, but then whoever can edit properties can redirect the summary.
- Email quotas. Google's quotas page lists 100 recipients a day for consumer accounts and 1,500 for Workspace. One summary a day is far from that, but the same project may send other mail. The other limits that matter are collected in what Apps Script really costs.
- A renamed sheet.
getSheetByName('Orders')returns null if someone renames the tab, and the script throws. Google's failure notices belong to the trigger, and so to the account that created it, which is the second reason to know whose trigger it is. - Status values beyond "open". The fix accepts any capitalisation and surrounding spaces. It does not accept "Opened" or "Pending", on purpose. If your team uses several words for the same state, use a dropdown in the status column so there is only one.
How this breaks over time
- People change. The account that installed the trigger leaves the company, its triggers stop, and the summary simply stops arriving. The date guard does not help with that. Install the trigger from a shared or long-lived account, and check after anyone with a trigger leaves.
- The older list grows. Orders nobody closes pile up in "older and still open", and after a few weeks that section is long enough that nobody reads it. That is useful information about the process, but it may be worth capping the list and showing only the count.
- The sheet grows.
getDataRange().getValues()reads every row every morning. Archive closed orders once the sheet is large enough that the run gets slow.
What I tested, and what I did not
The three blocks ran in Node against mocked Apps Script services: a fake sheet, MailApp, PropertiesService, LockService, Session, and a ScriptApp whose getProjectTriggers() returns only the current account's triggers, as Google's reference describes. 39 tests pass in three time zones (UTC, Istanbul, Los Angeles). I then broke the code on purpose 34 times, for example removing the date guard, writing the date before sending, matching the status exactly, or using UTC instead of the script time zone, and the tests caught all 34. The problems in the table come from running the original code in the same harness.
I have not run this in a real Apps Script project, so I have not measured how two real triggers set for the same hour are spaced, whether the script lock is ever contended in practice, or what a Date prints as in Apps Script itself. I have not tested the Office Scripts and Power Automate side at all, so I make no claim about whether a duplicated flow or a renamed workbook behaves better or worse there.
The takeaway
The Google side of the comparison wins on the number of pieces, and it keeps that advantage only if the one piece guards itself: a setup that can run twice, a send that happens once a day whoever's trigger fires, and a definition of "open" and "yesterday" written in the code rather than assumed. The full comparison of Apps Script, Office Scripts, VBA and Power Automate, including costs and limits on both sides, is in the Apps Script vs Office Scripts guide on the MageSheet blog.
Drafted with AI help; the code was run and tested, and every number comes from those tests.




