How to Automate Google Sheets with Apps Script + ChatGPT

You can automate Google Sheets by asking ChatGPT to write Google Apps Script code, then attaching that code to a trigger so it runs by itself — on a schedule, when someone edits the sheet, or when a form response arrives. You do not need to know JavaScript: describe the task in plain English, paste the generated code into the Apps Script editor, and set the trigger once. This guide covers the exact prompts to use, the trigger setup steps, and the free-tier limits that decide what you can realistically automate.

Key Takeaways

  • ChatGPT writes the Apps Script code; a trigger is what makes it run automatically without you opening the sheet.
  • Use onEdit to react to changes, time-driven triggers for schedules, and onFormSubmit for form responses.
  • Apps Script is free with any Google account, but personal (gmail.com) accounts get about 90 minutes of total trigger runtime per day.
  • Every run must finish within 6 minutes, and one script can hold at most 20 time-driven triggers.
  • Always tell ChatGPT your sheet name, column layout, and trigger type — vague prompts produce code that fails on the first run.

Table of Contents

What Can You Automate in Google Sheets with ChatGPT?

Anything that follows a rule can be automated: sending a daily email summary of new rows, timestamping and moving rows when a status changes, cleaning duplicates every Monday morning, or emailing a confirmation when a form response lands. If you can describe the rule in one sentence, ChatGPT can usually turn it into working Apps Script.

It helps to separate two layers of AI help in Sheets. Formulas — including AI-generated ones from our guide on writing Google Sheets formulas with ChatGPT and the built-in =AI() function in Google Sheets — calculate values inside cells. Apps Script goes further: it can act. It sends emails, creates files, moves rows between sheets, calls other Google services, and runs while the spreadsheet is closed. That is what makes it automation rather than calculation.

Typical automations readers ask about fall into four groups:

  • Reports: email yesterday’s totals to your inbox every morning at 8 am.
  • Reactions: when column F changes to “Complete”, add a timestamp and move the row to a Done tab.
  • Housekeeping: remove duplicates, trim whitespace, and re-sort on a weekly schedule.
  • Intake: when a Google Form submission arrives, validate it and notify the right person.

If you have never generated Apps Script with ChatGPT before, skim our starter guide on how to use ChatGPT to write Google Apps Script for Sheets first — it covers the editor basics and the permission dialog. This article builds on that by adding the piece that makes scripts hands-off: triggers.

How Do Apps Script Triggers Work?

A trigger tells Google when to run a function. Simple triggers (like a basic onEdit) fire automatically when you interact with the sheet but cannot do anything that needs permissions, such as sending email. Installable triggers — added in the editor’s Triggers panel — can use authorized services and include time-driven schedules that run even when the sheet is closed.

Trigger type When it runs Can send email / call services? Typical use
Simple onEdit Any manual edit No Auto-formatting, timestamps in the same sheet
Installable onEdit Any manual edit Yes Notify someone when a status cell changes
Time-driven Schedule you choose (hourly, daily, weekly…) Yes Daily reports, weekly cleanup jobs
onFormSubmit A linked Google Form is submitted Yes Confirmations, routing new entries

A simple decision framework: choose a simple onEdit if the script only changes the spreadsheet itself; choose an installable onEdit if a change should notify a person or another service; choose time-driven if the job should happen on a schedule with nobody in the file; choose onFormSubmit if the sheet is fed by a Google Form. When you prompt ChatGPT, name the trigger type explicitly — the code for a simple and an installable onEdit is not identical, and Google’s installable triggers documentation explains the restrictions behind that difference.

Step-by-Step: Set Up Your First Automation

The whole loop takes about ten minutes: generate the code in ChatGPT, paste it into the Apps Script editor, authorize it once, then attach a trigger in the Triggers panel. Here is the exact click path, using a daily email report as the example.

  1. Open your spreadsheet and go to Extensions → Apps Script. A new browser tab opens with the script editor.
  2. In ChatGPT (the free tier is enough for this), paste a prompt that includes your sheet tab name, the columns involved, and the trigger type — use the templates in the next section.
  3. Delete the placeholder function myFunction() in the editor, paste ChatGPT’s code, and press Ctrl+S (Cmd+S on Mac) to save.
  4. Click Run once in the toolbar. The first run opens Google’s authorization dialog: click Review permissions, pick your account, then Advanced → Go to (project name) and allow. This screen appears because the project is your own unverified script — it is expected.
  5. In the left sidebar, click the clock icon (Triggers), then + Add Trigger at the bottom right.
  6. Set function to run = your function, event source = Time-driven, type = Day timer, and pick an hour window (for example 8–9 am). Click Save.
  7. Verify it works: in the sidebar, open Executions after the scheduled window. A green “Completed” row means your automation ran; a red row shows the error message to paste back into ChatGPT.

Two habits prevent most beginner failures. First, run the function manually once after any code change — authorization errors only surface on a real run. Second, test against a copy of your spreadsheet if the script deletes or moves rows; a scheduled script with a wrong column letter can quietly damage data every day.

3 Copy-Paste ChatGPT Prompts for Sheets Automations

These prompts follow one pattern: name the sheet tab, describe the columns, state the rule, and name the trigger. Replace the bracketed parts with your own details and paste the result straight into ChatGPT.

Write a Google Apps Script function named sendDailySummary for a Google Sheet.
Sheet tab: "Orders". Columns: A = order date, B = product, C = amount (number).
The function should find all rows where the date in column A is yesterday,
then email me at [your@email.com] a plain-text summary: number of orders and
total of column C. I will run it on a daily time-driven trigger, so do not
include any UI code like alerts or menus.

What you should get: one self-contained function using SpreadsheetApp and MailApp. If ChatGPT adds an onOpen menu or Browser.msgBox, ask it to remove UI code — those calls fail inside time-driven triggers.

Write a Google Apps Script installable onEdit handler for a Google Sheet.
Sheet tab: "Tasks". Column F is "Status", column G is "Completed at".
When any cell in column F is edited to exactly "Complete", write the current
date and time into the same row in column G, then move that entire row to a
tab named "Done" (create it if missing). Include a setup function that
installs the onEdit trigger with ScriptApp.newTrigger.

What you should get: two functions — the handler plus a one-time setup function that installs the trigger. Run the setup function once manually; after that the handler fires on every qualifying edit.

Write a Google Apps Script function named weeklyCleanup for a Google Sheet.
Sheet tab: "Leads". Columns: A = date added, B = email, C = source.
Every run it should: 1) remove duplicate rows keeping the first occurrence,
comparing by lowercase column B; 2) trim whitespace in all cells of A:C;
3) sort by column A newest first; 4) log how many rows were removed with
Logger.log. I will schedule it weekly, Monday 7-8 am.

What you should get: a function that reads the data range once with getValues(), cleans it in memory, and writes it back with setValues() — much faster than editing cell by cell. If your version loops over ranges, ask ChatGPT to “rewrite using getValues and setValues for performance”.

When a run fails, open Executions, copy the red error line, and paste it back to ChatGPT with “this failed with: …” — a specific error message usually gets a working fix in one round trip.

Apps Script Limits You Should Know Before Automating

Apps Script itself costs nothing — it is included with any Google account, with no paid tier and no per-execution charge. What limits you is quota: as of July 2026, a personal gmail.com account gets roughly 90 minutes of total trigger runtime per day, each execution must finish within 6 minutes, and a single script can hold at most 20 time-driven triggers.

Limit (consumer / gmail.com account) Value What it means in practice
Max runtime per execution 6 minutes Long jobs must process data in batches
Total triggered runtime per day ~90 minutes Dozens of small scheduled jobs are fine; constant polling is not
Time-driven triggers per script 20 Consolidate related jobs into fewer functions
Email recipients per day (MailApp) ~100 Fine for personal reports, not for bulk mail

These figures come from Google’s official Apps Script quotas page, which is the place to re-check them — Workspace accounts get higher ceilings, and Google adjusts values occasionally. On the ChatGPT side, the free plan is enough to generate and debug scripts; the paid plans (ChatGPT Plus is $20/month as of July 2026) mainly buy you a newer model and higher message limits, which matters for long debugging sessions but is not required for this workflow.

For most spreadsheet automations these quotas are generous: a daily report that runs for ten seconds uses well under 1% of the daily trigger budget. The limit you are most likely to hit first is the 6-minute cap on a sheet with tens of thousands of rows — if that happens, ask ChatGPT to rewrite the script to process rows in batches and store progress in script properties.

Want an alert the moment one specific cell changes, instead of a scheduled digest? See How to Send an Email When a Cell Changes in Google Sheets for an installable on-edit trigger.

Not sure Apps Script is even the right tool for your task? Run through the Google Sheets automation checklist first — it maps common repetitive tasks to the right method (native feature, formula, or a script like this one) before you write any code.

FAQ

Is Google Apps Script free to use?

Yes — Apps Script is included free with any Google account, with no paid tier. As of July 2026 the only constraints are daily quotas (trigger runtime, email recipients, execution time), which are higher on Google Workspace accounts than on personal gmail.com accounts.

Can ChatGPT create the trigger itself, or only the code?

Both. ChatGPT can generate a setup function that installs triggers in code via ScriptApp.newTrigger, or you can add the trigger manually in the editor’s Triggers panel. Manual setup is easier to inspect and remove, so it is the better default for your first automations.

Do automations run when the spreadsheet is closed?

Time-driven and onFormSubmit installable triggers run on Google’s servers, so they work with the file closed and your computer off. Simple triggers like a basic onEdit only fire while someone is actually interacting with the sheet.

Leave a Comment