Write a Google Apps Script to Automate a Sheets Task with Dry-Run Mode
Get a working Google Apps Script for your Sheets task, with trigger setup, the permission screens you will see, and a dry-run mode that logs changes first.
You getWhat the script does, setup steps and permission prompts you will see
Prompt
Act as a Google Apps Script developer who builds safe automations for Google Sheets users who are not programmers.
Your job: write a script that automates one task in my spreadsheet. Before writing anything, ask me these questions in one message and wait for my answers:
1. What should the script do, step by step?
2. What are the sheet tab names and the column headers involved?
3. Should it run on a schedule, on edit, on form submit, or only when I click Run?
4. Roughly how many rows does the sheet have?
Rules:
- Include a DRY_RUN setting at the top, set to true by default. In dry-run mode the script changes nothing and logs every action it would take, with row numbers.
- Read and write data in batches (getValues and setValues), not cell by cell.
- Put trigger creation in its own function that I run once, and explain how to remove the trigger.
- List the exact permission screens I will see, including the unverified app warning, and what each scope allows.
- Comment the code in plain English.
Output format:
1. What the script does (3-5 lines)
2. Setup steps (numbered)
3. Permission prompts you will see
4. The full script
5. Trigger setup and removal
6. Test plan: dry run, check the log, then go live
End with one line on assumptions you made and what could break, such as renamed columns.Example output
Tips and common edits
Why this works
- Asking for tab names, headers and schedule first means the script fits your actual sheet instead of a guessed layout.
- A dry-run flag that defaults to true lets you check every planned change in the log before any data is touched.
- Listing the permission screens in advance stops users from abandoning the script at the unverified app warning.
Use in ChatGPT, Claude or Gemini when a repetitive Sheets job eats your time. Have your tab names, column headers and the schedule you want ready before you paste it.
Common edits
- Ask for an onEdit or form-submit trigger instead of a daily schedule.
- Ask the script to email you a summary of what it changed after each run.
Prompt details
- By
- Prompts-GPT editors
- Published
Did this prompt work?
Keep exploring
More like this
Build an Invoice Template in Excel or Google Sheets with Automatic Totals
You get a cell-by-cell invoice layout with exact formulas for line totals, discount, tax, due date, and a duplicate-proof invoice numbering system.
Design a One-Page Manager Dashboard in Excel or Google Sheets
Get a buildable one-page dashboard plan with a layout grid, a spec for each tile (metric, chart, filter, source range, formula) and numbered build steps.
Set Up Data Validation Rules That Stop Bad Entries in a Shared Excel Sheet
You get a column-by-column validation plan with allowed values, custom formulas, input and error messages, plus a helper formula that flags rows already holding bad data.
Build Excel and Google Sheets Formulas for Workdays, Ages and Deadlines
You get working date formulas for your exact layout, such as workdays, deadlines, ages and month offsets, with a holiday table, locale pitfalls and a test row.
Design a Clean Spreadsheet Layout for a Tracker or Budget That Scales
You get a complete sheet blueprint with tabs, column specs, data types, dropdown lists, summary formulas and setup steps that keep working as rows grow.
Explain Any Excel or Google Sheets Formula Step by Step in Plain English
Paste a formula and get a plain-language walkthrough in evaluation order, a table of what each part returns, common ways it breaks with fixes, and a simpler version.