Write a Google Apps Script to Automate a Repetitive Google Sheets Task
You get a commented Google Apps Script built around your sheet names, columns and timing, plus install steps, a test plan on a copy, and undo steps.
Prompt
Act as a Google Apps Script developer who builds automations for people who have never coded.
Your job: write a Google Apps Script that automates one repetitive task in my Google Sheet. Before writing anything, ask me these questions in one numbered message, then wait for my answers:
1. What task do you repeat, step by step, and how often?
2. What are the exact tab names involved, and which columns hold what (column letter plus header)?
3. When should it run: from a custom menu, when a cell is edited, or on a schedule (day and time)?
4. Is there any data the script must never change or delete?
Rules:
- Put every tab name, column letter and time in a labeled settings section at the top, so I can change them without touching the logic.
- Comment each section in plain English.
- Never delete a row without first copying it elsewhere, and write each change to a Log tab with a timestamp.
- Install steps must be click-by-click, naming exact menus and buttons, including the Google permission screen.
- Use only built-in Apps Script services.
Output format:
1. What the script will do (3 bullets)
2. The full script in one code block
3. Install steps (numbered)
4. Test run on a copy of the sheet: what to check
5. How to undo: remove the trigger, delete the script, restore data
6. Limits and risks
End with one line naming any assumption you made.Example output
Tips and common edits
Why this works
- Asking for exact tab names, columns and timing first means the script runs on the real sheet instead of a guessed layout.
- The copy-before-delete rule and Log tab make mistakes recoverable, which matters most for first-time script users.
- Click-by-click install, a test on a copy and undo steps cover the parts non-developers usually get stuck on.
Use when you repeat the same copy, move or cleanup job in Google Sheets every week. Have your tab names and column headers open. Works in ChatGPT, Claude or Gemini; paste the script into Extensions > Apps Script.
Common edits
- Ask for a custom menu button instead of a timed trigger so you control when it runs.
- Add an email summary to yourself after each run listing what changed.
Prompt details
- By
- Prompts-GPT editors
- Published
Did this prompt work?
Keep exploring
More like this
Build an Excel Formula from a Plain-English Description of What You Need
You get a working Excel formula, versions for older Excel and Google Sheets, a one-row worked example, and a table of the blank and error cases it handles.
Check If You Can Scrape a Website and Plan a Polite Scraper First
You get a Go or Don't verdict based on robots.txt, terms and privacy risks, a list of API or export alternatives, and a step-by-step polite scraping plan.
Batch Rename Files in a Folder with a Script You Can Preview First
You get a PowerShell or Bash rename script that shows every old-to-new name before changing anything, writes an undo log, and includes plain run steps.
Combine and Clean Multiple CSV or Excel Files into One Table with Power Query
You get a header mapping table, numbered Power Query clicks, commented M code that fixes mismatched columns and duplicates, and refresh steps for new files.
Plan a Zapier or Make Workflow from a Manual Process You Describe
Get a step-by-step automation plan that maps each manual task to a trigger, filter or action, flags paid-plan needs, and includes failure alerts and a test checklist.
Turn Your Inbox Problems into Gmail or Outlook Rules You Can Set Up Today
Get a numbered set of Gmail filters or Outlook rules with exact conditions, actions, run order, conflict warnings, setup clicks and a test for each rule.