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

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

说明与用途

作者用 Google Apps Script 替代昂贵的 SaaS,初期出现多种问题。通过批量写入、缓存去重、脚本锁定并检查执行时间,最终实现了稳定且无成本的自动化。

问题

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

结果

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.

工作流

  • 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.

证据

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

来源

CacheService is the right tool here rather than PropertiesService

来源

LockService.getScriptLock() rather than getUserLock()

来源

Apps Script kills any execution at six minutes

来源

  • 记录日期: 2026-09-20T02:00:21.200Z