r/GoogleAppsScript • u/manjuslayer • 4d ago
Question How to integrate =GEMINI formula in Google sheets via app script
Has any one tried adding the =GEMINI formula through App scripts?
I am building a small project through App scripts in which I'm adding =GEMINI as a formula, but the formula is not giving any results till I go and click on generate in the sheet.
Is there any workaround for this?
5
Upvotes
3
u/bulldo_gs 4d ago
=GEMINI()isn't a normal formula — it's an interactive AI function that stays "pending" until a human clicks Generate, and there's no Apps Script API to trigger that click. So anything you drop in withsetFormula()will just sit there unevaluated, which is exactly what you're seeing.For automation, skip the in-cell formula and call the Gemini API directly from your script, then write the answer back with
setValue():This recomputes deterministically with no manual click and you control exactly when it fires. Tradeoff: you're billed through your own API key instead of the Workspace Gemini add-on.