Reads a cached value by key.
class CacheService method .get()
CacheService is the Apps Script service.
.get() is the method name you will see after a dot in your code.
What it does
Why it's used
- Read a cached value before making another API call.
- Check if you already fetched today's rates.
Common errors
- Forgetting parentheses on get. Write CacheService.get(), not CacheService.get or get by itself.
- Skipping dots between chained calls. Each step needs a dot, like CacheService.get().
- Adding spaces where they do not belong. Write CacheService.get(), not CacheService .get(), CacheService.get (), or CacheService . get().
- Wrong capitalization. Use CacheService and get, not cacheservice or get.
Explore
Related methods
-
.remove()
Deletes a cached value by key.
-
.getUserCache()
Returns a cache private to the current user.
-
.put()
Stores a value in the cache for a set time.
-
.getDocumentCache()
Returns a cache tied to the current spreadsheet or doc.
-
.getScriptCache()
Returns a cache shared by all users of the script.
More Apps Script
Better Sheets tutorials
No tagged tutorials yet. Fetch Apps Script from the harvest table and this page fills automatically.