GAS AI BuilderApps Script Assistant Sign in

Keep settings and secrets out of the code

Apps Script recipes › APIs, cache and settings

Script Properties hold API keys and settings; a setup function asks for them once.

File Code.gs

function setting_(name, fallback) {
  const value = PropertiesService.getScriptProperties().getProperty(name);
  return value === null ? fallback : value;
}

/** Run once from the editor, then delete the key from this code. */
function saveApiKey() {
  PropertiesService.getScriptProperties().setProperty('API_KEY', 'paste-the-key-here');
}

Good to know

Let the AI put it in your appGAS AI Builder knows every recipe here. Describe your app and it uses this code where it fits, in a Google Apps Script project in your own Drive.

Use it in a project

More in APIs, cache and settings

Make slow reads fast with a cacheKeeps the result of a slow read for a few minutes, so a page that opens often doesn't read the whole sheet each time.Call an API with retriesCalls an address, reads JSON, and tries again after a short wait when the service is busy (429 or 5xx).