Skip to main content

Manage your cache

If cache is enabled for a spreadsheet, GPT for Sheets stores GPT function executions for 30 days. When formulas are reloaded (which happens on many occasions outside our control), the formula results are reused, avoiding extra costs and loss of results. This 30-day caching provides ample time to replace formulas with their final results.

Your cache includes GPT function executions made on any cache-enabled spreadsheet that is tied to your GPT for Sheets balance, regardless of which user executes the functions on that spreadsheet. Your cache is available across all these spreadsheets.

info

GPT function executions are stored encrypted with AES-256.

Prerequisites
  • You are the Owner of the spreadsheet (if the file is in My Drive) or its Creator (if it's in a Shared Drive).
  • You are not using Safe mode.

Enable cache to save costs and reuse previous results when reloading a formula

Enable cache in your spreadsheet settings to reuse previous results when reloading a formula instead of generating new results. Cache is enabled by default on new spreadsheets and is our recommended setting.

  1. In the GPT for Sheets sidebar, click Settings.

  2. Click on the Enable cache switch to start saving results.

Caching is enabled for GPT function executions in your spreadsheet.

Disable cache to experiment with sidebar settings

If you want to quickly experiment with various settings, you can disable cache usage. Disabling your cache doesn’t clear its content. It stops storing new executions and fetching existing ones from it.

  1. (Optional) Replace GPT formulas with their results if you want to preserve the current results.

  2. In the GPT for Sheets sidebar, click Settings.

  3. Click on the Enable cache switch to put it in disabled state.

Caching is disabled for GPT function executions in your spreadsheet. Each time the formulas are reloaded, they will be executed again, incur costs, and may return new results.

How caching works across spreadsheets and users

The spreadsheet is stored in My Drive:

  • If you are the Owner of this spreadsheet: You can enable/disable the cache for that spreadsheet. All your GPT function executions within this spreadsheet are stored in your cache and are available from other spreadsheets you own, provided that cache is enabled on them.
  • If you share this spreadsheet: All the GPT executions run by editors with whom you’ve shared the spreadsheet are stored in your cache.
  • If you have edit access to this spreadsheet: You can benefit from the full cache of the Owner from this spreadsheet.
  • If the ownership is transferred: The cache is not transferred to the new Owner. Next time the formulas are reloaded in this spreadsheet, they will be executed again. Make sure to replace formulas with results before transferring ownership!

The spreadsheet is stored in a Shared Drive:

  • If you are the Creator of this spreadsheet: You can enable GPT functions and your GPT for Sheets cache for that spreadsheet. All the GPT function executions run within this spreadsheet (both yours and those of other users) are stored in your cache and are available from other spreadsheets you have created, provided that cache is enabled on them.
  • If you share this spreadsheet: All the GPT executions run by editors with whom you’ve shared the spreadsheet are stored in your cache.
  • If you have edit access to this spreadsheet (Contributor or higher): You can benefit from the full cache of the Creator from this spreadsheet.

For more information, see Collaborate on the same spreadsheet.

Conditions for cached results reuse

GPT for Sheets cache relies on the formula's content, meaning all the input parameters within the formula itself. If the formula is the same, cached results are used, even if the sidebar settings have changed.

Formulas are considered identical by GPT for Sheets after resolving cell references. =GPT(A1) and =GPT(B9) are identical if the content of A1 and B9 is the same.

info

If you want to experiment with sidebar settings, you must disable cache.

Therefore, if you copy a simple formula like =GPT("write a tagline for an ice-cream-shop") to another cell, cached results are used. If you change your sidebar settings and reload the formulas in your spreadsheet, cached results are also used.

On the other hand, if you change any parameter in a formula, the cache is invalidated and a new result is generated. =GPT("a prompt", , 0.2) is not the same as =GPT("a prompt", , 0.3) because the temperature parameter value is different. You can use this technique to forcefully bypass your cache when it’s enabled.

When to use the cache or Safe mode

Cache and Safe mode are mutually exclusive and serve different purposes:

  • Use the cache by default most of the time.
  • Only use Safe mode if you’re facing timeouts. In particular, use Safe mode if you’re planning on running no more than a few hundred executions, using particularly slow models such as gpt-4-turbo or gpt-4, and if you’re expecting long generations (over 500 words) which will be slower and could time out.

The following table provides more details about the differences between cache and Safe mode.

CacheSafe mode
# executions cached/stored100K
(executions are stored in our backend)
Unlimited*
(executions are stored in your spreadsheets)
Cache/storage expiration7 days for free users and 30 days for paid usersUnlimited
TimeoutsDoesn’t avoid timeoutsAvoids timeouts
Speed of executionDoesn’t affect speedSlows down executions a lot
Models supportedAll modelsgpt-4 and gpt-4-turbo models; Perplexity AI's online model (with GPT_WEB)
Across spreadsheetsResults are stored at user level, and can be reused across spreadsheetsResults are stored at formula level, a formula can be copied and pasted along with its result

* Unlimited = Within Google Sheets limits