Example result: Automate Google Sheets with Apps Script
AI-generated example · Build · Sheets Automation
Updated

Automate Google Sheets with Apps Script

This prompt writes a Google Apps Script for your sheet, such as a daily email of rows due today. It adds a menu item to run it by hand, an optional timed trigger and clear steps to test it on a copy.

text-code-google-sheets-apps-script — claude — 88 words

Act as a Google Apps Script expert.

My sheet: [DESCRIBE THE TABS AND COLUMNS]
What I want automated: [e.g. every morning, email me rows where due date is today]

Write the full script with comments, a menu item to run it by hand, and a time-driven trigger if it should run on its own. Handle empty rows and bad dates. Tell me exactly where to paste the code, what permissions Google will ask for and why, and how to test it on a copy of the sheet first.

Test on a copy of your sheet. Scripts can change many rows at once, and undo does not always catch it.

Get a better result

What you will get

A complete commented script with a menu item to run it by hand and a trigger if needed, which handles empty rows and bad dates, plus instructions on where to paste it, what permissions it asks for and how to test it.

Common mistake

The script cannot find your columns.

Fix: List the tab names and column headings exactly as they appear, including spaces and capitals. Paste a few sample rows.

Also watch for
  • It runs but sends too many emails. Ask for a small test mode that logs what it would send instead of sending, and use a copy of the sheet first.
  • Google shows a scary permission warning. Ask the AI to explain each permission in your script. Only accept scopes that match what the script does.
Try a variation: add a log tab

Ask for “a Log tab that records the time, the rows touched and any errors on each run”. It makes problems easy to trace when the script runs on its own.

Still not right? Reply with this

Add a test mode that writes the planned actions into a new tab and sends nothing. Then show how to switch it off.

Guides on this topic

More chat & writing prompts

See all 465 →