Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

I replaced $700/month of SaaS with Google Apps Script. Here’s what broke first.

Description and use

The author replaced a costly SaaS stack with Google Apps Script but faced failures under load. By batching writes, caching for idempotency, locking for concurrency, and checkpointing to respect runtime limits, the solution became reliable and cost‑effective.

Problem

High monthly SaaS costs for simple data transfer and arithmetic were replaced with a Google Apps Script solution that initially failed under higher load.

Outcome

The refactored script runs without hitting service quotas, avoids duplicate writes, prevents data loss from concurrent executions, and respects the 6‑minute execution limit, eliminating the $700/month SaaS expense.

Workflow

  • 1. Replace per‑row appendRow calls with a single setValues batch write.
  • 2. Implement idempotency using CacheService to dedupe webhook events.
  • 3. Use LockService.getScriptLock() to serialize writes and avoid race conditions.
  • 4. Add checkpointing logic to stop processing before the 6‑minute runtime limit and schedule continuation via triggers.

Evidence

One call instead of four hundred: ... setValues(rows);

Source

CacheService is the right tool here rather than PropertiesService

Source

LockService.getScriptLock() rather than getUserLock()

Source

Apps Script kills any execution at six minutes

Source

  • Record date: 2026-09-20T02:00:21.200Z