π¨ Heads up Google devs β 4 gotchas building a Gemini + Sheets Cloud Function agent (Python)
βββββββββββββββββββββββββββββββββββββ
1οΈβ£ google-generativeai is dead
Symptom: 404 on gemini-1.5-pro, FutureWarning on import
Cause: SDK EOL, v1beta endpoint dropped the model
Fix: pip install google-genai>=1.0.0, swap to Client() API
model = "gemini-2.0-flash"
βββββββββββββββββββββββββββββββββββββ
2οΈβ£ AI Studio API keys β GCP project keys
Symptom: 429 RESOURCE_EXHAUSTED, limit: 0 β even with billing + $300 credits
Cause: Studio keys live in Google's shared project, NOT yours. Your GCP billing doesn't cover them.
Fix: Create the key at console.cloud.google.com/apis/credentials inside your project, not aistudio.google.com
βββββββββββββββββββββββββββββββββββββ
3οΈβ£ Sheets API rejects unquoted tab names with spaces
Symptom: 400 "Unable to parse range: Raw Data!C2:C"
Cause: Tab names containing spaces must be wrapped in single quotes in range strings
Fix: RAW_TAB = "'Raw Data'" (embed the quotes in the constant)
f"{RAW_TAB}!C2:C" β 'Raw Data'!C2:C β
βββββββββββββββββββββββββββββββββββββ
4οΈβ£ GOOGLE_APPLICATION_CREDENTIALS overrides ADC silently
Symptom: "File ./service-account-key.json was not found" even after successful gcloud auth application-default login
Cause: If that env var exists (even pointing at a missing file), google-auth skips ADC entirely
Fix: Remove it from .env. Use ADC only:
gcloud auth application-default login
--client-id-file=oauth-client.json
--scopes="...spreadsheets,...drive.file,...cloud-platform"
Note: default gcloud client ID BLOCKS spreadsheets scope β you must use your own OAuth Desktop client ID.
βββββββββββββββββββββββββββββββββββββ
None of these are in the quickstart docs. Hope this saves someone a few hours. π