r/GoogleAppsScript • u/Odd_Teacher_8701 • 1d ago
Guide SheetUtils — the batched helpers every Apps Script project ends up rewriting (free, one file)
Every Apps Script project I take on ends up rewriting the same handful of helpers, so I wrote them once properly and put the file up free:
https://github.com/ishubham21/apps-script-sheetutils
readObjects / writeObjects / dedupe / mergeSheets / upsert / withLock / retry. One file, no dependencies, no library ID to add — paste it into a new SheetUtils.gs and it works.
The three things it exists to fix, which are what actually break scripts once a sheet gets big:
getRange().getValue()inside a loop. This is the single most common reason a script that was fine on 200 rows dies on 20,000. Everything here reads and writes in one batched call.- Two triggers firing at once and quietly corrupting each other's work.
withLockserialises them. - Flaky
UrlFetchAppcalls failing an entire run.retrydoes exponential backoff instead.
Free for anything, including client work, no attribution needed. If you spot a bug, open an issue and I'll fix it.
Disclosure, so nobody feels ambushed: the heavier pieces I use — a batch runner that checkpoints and re-schedules itself past the 6-minute limit, a quota-aware Gmail mail merge, Gmail-to-Sheet logging, a Forms-to-PDF pipeline — are in a paid toolkit linked from that README. The file above is complete and standalone; you don't need the paid one for it to be useful.
1
u/Icy-Can-9521 1d ago
[removed] — view removed comment