Key Takeaways
- Gemini in the Apps Script editor went generally available on 12 November 2026; open it with the spark icon in Extensions > Apps Script.
- It needs Workspace Business Standard or Plus, Enterprise Standard or Plus, or Google AI Pro or Ultra, and it works for Hong Kong accounts.
- Once saved, the script runs as ordinary code, so scheduled runs do not use Gemini; Apps Script quotas still apply.
If someone on your team spends 40 minutes every Monday pasting a sales sheet into a Doc, one prompt in the Apps Script side panel can take that job over. Gemini writes the script, you read it, and a trigger runs it before anyone is in the office.
What can Gemini in Apps Script automate for you?
It writes Apps Script from a plain-language request: moving data between Gmail, Calendar, Sheets, Docs, Slides and Forms, adding custom menus and time-based triggers, and explaining errors. You review each suggested code block, accept or reject it, then save and run. It works only on projects you own or can edit.
Google announced general availability in its Workspace Updates post, with a gradual rollout of up to 15 days from 12 November 2026. Google opened Gemini to all Hong Kong users in March 2026, according to SCMP, so no workaround is needed.
| Tool | Writes scripts from a prompt? | Where to find it | Usable in Hong Kong? |
|---|---|---|---|
| Gemini in Apps Script | Yes, with block-by-block Accept or Reject | Sheets, Docs, Slides or Forms > Extensions > Apps Script > spark icon | Yes, on eligible plans |
| Apps Script triggers | Runs the saved script on a schedule or event | Editor left menu > Triggers (clock icon) | Yes, any Google account |
Limits worth knowing before you start
- Each run stops after 6 minutes, and triggers can run 6 hours a day in total on Workspace accounts (90 minutes on personal Gmail), per Google's Apps Script quotas.
- The side panel shows only when the editor language is English or the default, so write prompts in English.
How do you turn urgent Gmail messages into Calendar events?
Ask Gemini for a function that searches Gmail for a label or subject word, creates a follow-up event for each match in Hong Kong time, skips messages it has already handled, and runs every morning on a time-driven trigger. Open a new project at script.new for this one, because it is not tied to a file.
Scenario: an account manager flags client emails with an Urgent label and forgets half of them by Thursday.
Write a function that searches my Gmail for messages from the last 24 hours with the label [Urgent]. For each message, create a 30-minute event on my default Calendar tomorrow at [10:00] in the Asia/Hong_Kong time zone. Title: "Follow up: " plus the email subject. Description: the sender and a link to the email. Store each processed message ID so the same email never creates two events. Then add a time-driven trigger that runs the function every day at [08:00].
What a good result includes
- A GmailApp search query you can read, such as label plus newer_than:1d.
- Processed IDs saved in script properties, not in a hidden sheet.
How do you turn a Sheets table into a weekly Docs report?
Open the spreadsheet, go to Extensions > Apps Script, and ask for a function that filters the last seven days, totals by your grouping column, writes a new Doc with a heading, a table and one summary sentence, saves it to a named folder, and adds a custom menu so anyone can run it.
Scenario: the Monday sales update that someone builds by hand from a 2,000-row sheet.
In this spreadsheet, read the sheet named [Sales]. Keep rows where column [Date] is within the last 7 days, using the Asia/Hong_Kong time zone. Total [Orders] and [Revenue] by [Region]. Create a new Google Doc titled "Weekly report " plus today's date (YYYY-MM-DD) containing: a heading, a table with columns Region, Orders, Revenue (HK$, no decimals), and one sentence naming the region with the largest change against the previous 7 days. Save the Doc in the Drive folder with ID [folder ID]. Add a custom menu "Reports > Build weekly report" that runs the function.
What a good result includes
- Columns found by header name, not by fixed letters, so inserting a column does not break it.
- The folder ID written exactly as you gave it. Google notes generated code may drop URLs, so paste IDs in full.
How do you route Google Form responses to the right colleague?
Bind the script to the Form's response sheet and ask for an installable on-form-submit trigger that reads one answer, looks up the owner in a second sheet, and emails that person every answer. Keep the lookup table in the sheet, so changing owners never needs a code change.
Scenario: an internal IT or facilities request form whose replies sit unread in one shared inbox.
This spreadsheet receives responses from a Google Form. When a new response arrives, read the answer to [Which department?]. Look up that department in the sheet [Owners] (column A department, column B email) and send that owner an email with subject "New request: " plus the [Request title] answer, listing every question and answer from the response. If no owner is found, send it to [ops@yourcompany.com]. Use an installable on-form-submit trigger and write "Sent to " plus the email address in a new column [Routed to].
What a good result includes
- An installable trigger, because a simple trigger cannot send email.
- A fallback address, so no request disappears.
How do you clean a messy contact list in Google Sheets?
Ask Gemini to write the cleaned data to a new sheet and leave the original untouched, then spell out every rule: trimming, name case, the Hong Kong phone format, how to treat invalid numbers and which duplicate to keep. Vague rules such as clean this up produce code you cannot predict.
Scenario: 1,200 event sign-ups with phone numbers typed five different ways.
Read the sheet [Leads]. For each row: trim spaces in every cell; write [Name] in Proper Case; convert [Phone] to the format "+852 XXXX XXXX" after removing spaces, dashes and any existing 852 or +852 prefix; if the result is not exactly 8 digits, keep the original value and write "Check" in a new column [Phone check]. Remove rows with the same [Email], keeping the row with the latest [Timestamp]. Write the result to a new sheet [Leads_clean] and do not change [Leads]. Log how many rows were removed and how many phones were flagged.
What a good result includes
- Data read and written in one batch with getValues and setValues, which keeps a 1,200-row run well inside the 6-minute limit.
- A count in the execution log that matches what you see in the new sheet.
How do you fix a script that runs but gives the wrong result?
For a runtime error, click Fix with Gemini in the execution log and review its diff. For a script that finishes without errors but outputs the wrong numbers, describe what you expected, what you got and the function name. Google's guide says this kind of specific prompt gets better fixes.
Scenario: the weekly report shows zero orders even though the sheet has more than 100 rows for the week.
The function [buildWeeklyReport] runs without errors but reports [0 orders] for last week. Expected: about [120 orders]. Check the date filter and whether the script and spreadsheet time zones both use Asia/Hong_Kong. Explain the cause in plain language first, then propose the smallest change that fixes it. Do not rewrite other functions.
What a good result includes
- A cause you can verify yourself, such as dates stored as text or a UTC time zone in the project settings.
- A small diff, not a full rewrite.
How do you adapt these prompts to your own files?
Replace every bracket with your real sheet names, column headers, times and IDs, keep one task per prompt, and add the limits you care about, such as a maximum number of emails. Then test on a copy of the file, read the OAuth permission screen, and only switch on the trigger after a clean manual run.
- Ground it. Type @ followed by a Doc or Sheet URL in the panel to give Gemini a reference file; the file picker is not supported.
- Cost per run. Gemini is included in the eligible plans, and saved scripts run as plain code, so a daily trigger adds no AI charge; the limits are the Apps Script quotas above.
Last verified: 2 December 2026, against Google's Gemini in Apps Script guide and quota page.
Write the prompt, then read the code
Gemini removes the blank-page problem in Apps Script, but the script still runs with your permissions. Name the sheets, the time zone and the limits, accept code block by block, and test on a copy first.
Empowering AI. Centered on you.
Rather not build and maintain these scripts yourself?
Triggers break when sheets change, owners leave and permissions expire. If you would rather not build and maintain this layer yourself, UD's AI Staff take on the role and run it for you, and we'll walk you through every step from a free configuration assessment to day-to-day operation.
Frequently Asked Questions
Is Gemini in Apps Script available in Hong Kong?
Yes. Gemini has been open to Hong Kong users since March 2026, and the side panel works on Workspace Business Standard or Plus, Enterprise Standard or Plus, or Google AI Pro or Ultra, if your admin has Gemini turned on.
Does a scheduled script use up my Gemini allowance?
No. Gemini only helps write and fix the code. A saved script runs as normal Apps Script, limited by Google's quotas, for example 6 hours of trigger runtime a day on Workspace accounts.
Can my company stop staff from using it?
Yes. Admins control it through the Apps Script service setting and Workspace generative AI access controls, by organisational unit or group, and can review script activity in Drive and OAuth audit logs.