How to use Gemini in Apps Script: build Google Workspace automations without coding

Google made the Gemini side panel in Apps Script generally available in November 2026. Here is how to open it, turn a plain-English request into a working script, approve it safely and fix it when it breaks.

The short answer

To use Gemini in Apps Script, open Extensions > Apps Script in a Google Sheet, Doc, Slides file or Form (or go to script.new), click the Gemini spark icon, describe the automation in plain English, accept or reject the proposed code block by block, then save, run and approve the permission prompts. Google made the side panel generally available on 16 November 2026 for Workspace Business Standard and Plus, Enterprise Standard and Plus, and Google AI Pro and Ultra.

Made byGoogle
StatusGenerally available, announced 16 November 2026
RolloutFrom 12 November 2026, up to 15 days
PlansBusiness Standard and Plus, Enterprise Standard and Plus, AI Expanded Access, Google AI Pro for Education, Google AI Pro and Ultra
Open itExtensions > Apps Script, then the Gemini spark icon
What it doesWrites, changes, explains and debugs script code
What it does not doRun the script for you; you save, run and approve
LimitsActive file only, English editor language, no Drive file picker

What Gemini in Apps Script is, and what changed in November 2026

Google Apps Script is the small programming tool built into Google Workspace. It lets a script add a custom menu to a Google Sheet, send emails from a list, file attachments into Drive or run a job every morning on a timer. Until recently you had to write that JavaScript yourself or copy it from a forum. Gemini in Apps Script is a side panel inside the Apps Script editor where you describe what you want in plain English and Gemini writes or changes the code for you, explains Apps Script concepts and helps fix errors.

Google announced on 16 November 2026 that the Gemini side panel in Apps Script is generally available, after a public beta earlier in the year. The rollout started on 12 November 2026 for both Rapid Release and Scheduled Release domains and can take up to 15 days before everyone sees it. Google's pitch is that anyone in an organisation can now create, customise and troubleshoot scripts without coding experience. That is broadly true, with one honest catch: Gemini writes the code, but you still decide what runs on your account, so you need to read what it proposes and approve the permissions it asks for.

Google's own examples show the kind of work it is for: creating Google Calendar events from urgent Gmail messages, turning tables in Google Sheets into formatted Google Docs reports, pulling and cleaning real-time data, and adding time-based triggers so a script runs on a schedule. If you already use Gemini in Gmail and Docs, this is the step from asking Gemini for an answer to asking it to build a small tool that keeps working after you close the chat. For a wider view of what to automate, see how to automate tasks with AI.

What you need first

  • An eligible plan. Google lists Google Workspace Business Standard and Business Plus, Enterprise Standard and Enterprise Plus, the AI Expanded Access add-on, Google AI Pro for Education, and the consumer plans Google AI Pro and Google AI Ultra. Google's developer guide also names Workspace Gemini add-on licences such as Gemini Business and Gemini Enterprise. Neither page lists a free personal Google account, so plan on needing one of these.
  • Gemini switched on by your admin. Google's developer guide says a Workspace administrator must enable Gemini features in the Google Admin console. Google's announcement adds that Gemini respects the existing Apps Script service setting (Apps > Google Workspace > Drive and Docs > Google Apps Script) and the Workspace generative AI access controls, which admins can set by organisational unit or group.
  • Edit access to the script. Gemini only works on script projects you own or can edit.
  • English as the editor language. The side panel appears only when your language setting is English or the default. Some prompts in other languages work, but Google says not all are supported.
  • One Google account in the browser. The panel might not load if you are signed in to several Google accounts at once. Use a browser profile with a single account, or an incognito window.

How to use Gemini in Apps Script, step by step

  1. Open the Apps Script editor. From a Google Sheet, Doc, Slides file or Form, choose Extensions > Apps Script. This creates a script attached to that file, which is what you want for custom menus and custom functions. For a standalone script, go to script.google.com or type script.new in the address bar.
  2. Open the Gemini panel. On a new script the panel opens automatically. Otherwise click the Gemini spark icon, labelled Ask Gemini, in the panel menu at the top right of the editor.
  3. Describe the job. Type your request in the box at the bottom of the panel and press Enter. Name the exact sheet, columns, email subject, folder or schedule. You can also pick one of the starter prompts Google shows in the panel.
  4. Point Gemini at your files with @. The Drive file picker is not supported for grounding. Instead, type @ followed by the full URL of the Doc or Sheet the script should use. Google also warns that Gemini occasionally leaves URLs out of generated code for security reasons, so put the exact URL in your prompt and check it appears in the code.
  5. Review the changes block by block. Gemini shows its proposal as a diff, with a preview bar and arrows to move between changes. Choose Accept or Reject for each block, or Accept all and Reject all for the whole proposal. Read at least the lines that send email, delete anything or share files.
  6. Save and run. Save the project, pick the function in the toolbar and click Run. The first run shows the standard Google OAuth permission screens. Check which services the script wants (Gmail, Drive, Calendar) and click Allow only if that matches the job.
  7. Fix errors with one click. If the run fails, the error appears in the Execution log. Click the Gemini fix button there (Google's developer guide calls it Fix with Gemini; the announcement calls it Fix errors). Gemini explains what went wrong and inserts a suggested change, which you accept or reject, then save and run again.
  8. Ask questions as well. You can ask conceptual questions, such as the difference between a simple trigger and an installable trigger. Google says those answers do not change your code.

A worked example: a weekly report from a Google Sheet

Say a sales coordinator keeps a Google Sheet called Pipeline with columns for Account, Owner, Stage, Amount and Close date, and spends every Monday copying the open deals into a Google Doc for the team meeting. Here is how the same job looks with Gemini in Apps Script.

  1. In the Sheet, open Extensions > Apps Script. The Gemini panel opens on the new script.
  2. Prompt: "Create a custom menu in this spreadsheet called Reports with an item Weekly pipeline. When clicked, read the sheet named Pipeline, keep rows where Stage is not Closed, sort by Close date, and write them as a table into a new Google Doc titled Pipeline report plus today's date. Then show the Doc link in a dialog."
  3. Review the diff. Check the sheet name and column names match your file exactly, because a script reads them literally.
  4. Save, run the onOpen function once, approve the Sheets and Docs permissions, then reload the spreadsheet. A Reports menu appears.
  5. When it works, follow up in the same panel: "Add a time-based trigger that runs Weekly pipeline every Monday at 8 a.m. and emails the Doc link to me." Review, save and approve again, because sending email is a new permission.

This is close to the example in Google's own guide, which shows a custom Export to Docs menu in Google Sheets. The point is the order: get a small working version first, then add the trigger and the email. One long prompt that asks for everything at once is harder to check and harder to fix. If the data side is the hard part, how to use AI for spreadsheets in Excel and the best AI for spreadsheets cover formulas and analysis rather than scripts.

Common mistakes and how to fix them

  • The Gemini panel is missing. Check your plan against the list above, ask your admin whether Gemini and Apps Script are both allowed for your organisational unit, switch the language to English, and sign out of other Google accounts. The rollout can also take up to 15 days from 12 November 2026.
  • Gemini changed the wrong code. Gemini works on the file that is open in the editor. In a project with several .gs files, open the right file before you prompt.
  • The script cannot find your Doc or Sheet. Paste the full URL with @ in the prompt and confirm it is in the generated code, since Gemini sometimes removes URLs.
  • The script runs but the output is wrong. Say so plainly. Google's own suggested prompts include "The script doesn't throw an error but the output is wrong. Fix it." Add one example of the wrong output and the right output.
  • Permission screens look scary. They are the normal OAuth prompts every Apps Script shows, and they are your best safety check. If a reporting script asks to delete Drive files or send email and you did not ask for that, reject it and ask Gemini why.
  • A scheduled script depends on one person. Google says installable triggers, such as a weekly schedule, always run under the account of the person who created them. For team processes, agree who owns the script and keep a note of what it does.

Is Gemini in Apps Script the right tool?

Pick Gemini in Apps Script when the job lives inside Google Workspace, repeats on a schedule or a click, and needs to touch Gmail, Sheets, Docs, Drive or Calendar on your behalf. It has a real advantage over pasting code from a chatbot: it sees the script open in the editor, shows changes as a diff you can accept line by line, and can read the actual error from the Execution log.

It is not the right tool for a one-off question about your data; for that, ask Gemini in the Sheets side panel or follow how to analyse data with AI. It is also not the tool if your company runs on Microsoft 365 rather than Google Workspace, or if the workflow spans many outside apps, where a dedicated automation tool fits better (see the best AI for automation). And because a script acts with your permissions, anyone handling customer or financial data should agree the rules with their admin first. For the Gemini side of Workspace more broadly, see our Gemini guide, Gemini skills in Gmail and Docs and the Gemini course.

For admins, Google says the same controls apply as for any script: OAuth app access controls and external URL allowlists govern what scripts can reach, and activity shows up in Drive and OAuth audit logs. The side panel also follows Google Workspace data region policies.

Prompts to copy

Custom function

Create a custom function [FUNCTION_NAME] for this spreadsheet that [groups rows by column A / sums column D / looks up a value] and returns [what you want in the cell]. Add a short comment above the function explaining how to use it.

You get: A formula you can type into a cell, like =FUNCTION_NAME(A2:D50).

Gmail to Google Tasks

Write a script that searches my Gmail inbox for unread emails with '[WORD]' in the subject from the last [30] days and adds each one to Google Tasks with the subject as the title and a link to the email in the notes. Do not change or delete any email.

You get: A script that turns flagged emails into a task list without touching your inbox.

Sheet to Docs report menu

Create a custom menu in Google Sheets called '[MENU NAME]' that exports the table on the sheet named [SHEET] into a new Google Doc titled [TITLE] plus today's date, then shows me the link to the Doc.

You get: A one-click report from your spreadsheet into a formatted Doc.

Add a schedule

Add a time-based trigger that runs [FUNCTION_NAME] every [Monday at 8 a.m.]. Explain how I can see or delete the trigger later.

You get: The same script running on its own, plus how to switch it off.

Fix wrong output

The script doesn't throw an error but the output is wrong. For row [5] it returns [WRONG RESULT] and it should return [RIGHT RESULT]. Fix it and explain the change in one sentence.

You get: A targeted fix you can accept or reject in the diff view.

Free on Yuzoki Learn

Learn Gemini properly, 5 minutes at a time