Time in hours during which you want to keep your data before it is fetched again.
Google Sheets controls how the functions recalculate according to different behaviours (modifying cells, opening the spreadsheet, …)
To avoid that IMPORTJSON fetches the data source constantly, the content is cached 24 hours by default. Therefore, whenever IMPORTJSON recalculates, the content is retrieved from the cache.
You can customize the cache lifespan by setting the cacheLifespan option to the value you want the cache to last.
Values can be in hours, days or weeks. It accepts different syntaxes like 10h
, 10hours
, 10 hours
or even just 10
=IMPORTJSON(data_sources, filters, "cacheLifespan:2 days")
or
A | B | |
---|---|---|
1 | cacheLifespan | 48 |
2 | ||
3 | =IMPORTJSON(data_sources, filters, A1:B1) |
Bear in mind that the function will not necessarily update directly after the cache expires but only when Google Sheets lets the function recalculate.
A new request will be counted whenever the function has to fetch the content from the data source.
cacheLifespan is available from the Premium plan. The maximum value for cacheLifespan depends on your plan: 15 days for Premium, 30 days for High Volume.
Other ways to control how your data is updated:
Use automatic triggers if you need the function to update periodically.
See Set up automatic updates
Control the cache lifespan for all the functions in your spreadsheet through the sidebar
See Use the sidebar