Getting Past Google Apps Script's 6-Minute Limit and n8n Out-of-Memory Crashes
I build Google Sheets and Apps Script tools alongside small Python services, and I keep running into the same two walls as row counts grow. The first is the 03:06 AM Google Sheets failure email. An internal Google Apps Script that synced 400 orders or CRM leads in January now has 8,500 rows to process. Google kills the morning run halfway through with Exceeded maximum execution time . The script…
Google Apps Script and n8n both have limits that impact performance when handling large datasets. Google Apps Script has a 6-minute runtime limit, and n8n can crash due to memory issues when processing large CSV files. The source material discusses two main strategies to overcome these limitations: eliminating per-cell RPC calls in Google Apps Script and optimizing memory usage in n8n.
For Google Apps Script, one solution is to batch HTTP requests instead of making individual calls for each cell update. This approach reduces the time spent on network round trips, allowing the script to complete much faster. The provided code example demonstrates a function called `enrichSheetBatchFast` that takes a Google Sheet, start row, batch size, API endpoint, and API key as input parameters.
It retrieves a batch of values from the sheet, creates HTTP requests for each row with pending domains and statuses, and sends those requests concurrently using `UrlFetchApp.fetchAll()`. By processing rows in batches and sending multiple requests simultaneously, the function significantly reduces execution time.
The second strategy addressed in the source material is optimizing memory usage in n8n workflows. When processing large CSV files or Shopify catalogs, n8n can run out of memory and crash. To mitigate this issue, the source recommends keeping binary files in a filesystem rather than RAM (N8N_DEFAULT_BINARY_DATA_MODE=default). Additionally, it suggests avoiding looping through items in a single workflow with SplitInBatches, as this retains item history for each node across loop iterations in RAM, leading to memory exhaustion.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.