---
title: "Discussion on \"Google Sheets custom function errors: why =MYFUNC() breaks at scale, and the one-call-per-range fix\" | Hashnode"
description: "Discussion on \"Google Sheets custom function errors: why =MYFUNC() breaks at scale, and the one-call-per-range fix\". A Google Sheets custom function has 30 seconds to return a value, not the six minutes a normal Apps Script run gets. Every cell that uses it is a separate call to Google's servers, it can only use ser"
url: "https://hashnode.com/posts/google-sheets-custom-function-errors-why-myfunc-breaks-at-scale-and-the-one-call-per-range-fix/6af44312faf82077fc5fc737"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Google Sheets custom function errors: why =MYFUNC() breaks at scale, and the one-call-per-range fix](https://stocky-shutdown.hashnode.dev/google-sheets-custom-function-errors-why-myfunc-breaks-at-scale-and-the-one-call-per-range-fix?utm_source=hashnode&utm_medium=feed)

A Google Sheets custom function has 30 seconds to return a value, not the six minutes a normal Apps Script run gets. Every cell that uses it is a separate call to Google's servers, it can only use ser

1d ago · 6 min read · stocky-shutdown.hashnode.dev  
Read the article

-   [#google-sheets](https://hashnode.com/tag/google-sheets)
-   [#google-apps-script](https://hashnode.com/tag/google-apps-script)

## Written by

[Stack Architect](https://hashnode.com/@stackarchitect)

@stackarchitect · Manchester, UK

  
[View profile](https://hashnode.com/@stackarchitect)

## Responses 1

Markdown supported · ⌘↵ to post

[Hayrullah Kar](https://hashnode.com/@magesheet)

[2h ago](https://hashnode.com/posts/google-sheets-custom-function-errors-why-myfunc-breaks-at-scale-and-the-one-call-per-range-fix/6af44312faf82077fc5fc737/comment/6af5fe15fc3aa984e9a0012f)

Checking the time budget before each `fetchAll` batch, with room left for one slow batch, is a careful piece of design. One case it doesn't cover: a SKU that the endpoint answers with a 404, or without an `available` field, is never cached. It shows 'Not fetched yet' forever, which reads as 'wait a bit'. Every recalculation spends a request on it again, which eats into the 20-second budget meant for the SKUs that can succeed. For 404s specifically (not 5xx), you could cache a short-lived 'not found' marker, say for an hour, and return 'Unknown SKU' instead. That stops the repeat requests and tells the user something they can act on.
