Google Apps Script generator for Sheets, Gmail and Forms automations
Apps Script can email a row when a form comes in, build a weekly report in Docs or clean a sheet every night, but the API is big and the trigger setup is fiddly. Describe the automation and your todo.is agent writes a commented script, lists the permissions it needs, and walks you through adding it and its trigger.
The prompt
- Write a Google Apps Script that [WHAT IT SHOULD DO]. It works with [GOOGLE APPS AND FILES INVOLVED]. Sheet layout: [TABS AND COLUMNS]. Run it [WHEN IT SHOULD RUN]. Comment every function, use the sheet's header names instead of column numbers, avoid hitting Apps Script quotas, and log errors to a 'Log' tab. Then give me step-by-step setup: where to paste it, how to authorize it, how to add the trigger and how to test it safely with my own email first.
What to change
- [WHAT IT SHOULD DO]: E.g. "email the assigned person when a new support request comes in from our Google Form".
- [GOOGLE APPS AND FILES INVOLVED]: E.g. "a Google Form, its response sheet and Gmail", "a Sheet and a Docs template".
- [TABS AND COLUMNS]: E.g. "Form Responses 1: Timestamp, Name, Email, Issue, Priority, Assigned to".
- [WHEN IT SHOULD RUN]: E.g. "on every form submit", "every weekday at 8:00", "when I click a menu item".
Example result
- Code.gs: email the assignee on each new request
- // Runs on every form submission (installable trigger)
- function onRequestSubmit(e) {
- try {
- const sheet = e.range.getSheet();
- const headers = sheet.getRange(1, 1, 1, sheet.getLastColumn()).getValues()[0];
- const row = e.range.getValues()[0];
- const get = name => row[headers.indexOf(name)];
- const to = lookupEmail(get('Assigned to'));
- const subject = '[' + get('Priority') + '] New request from ' + get('Name');
- const body = 'Issue:\n' + get('Issue') + '\n\nReply to: ' + get('Email') +
- '\nSheet: ' + SpreadsheetApp.getActive().getUrl();
- GmailApp.sendEmail(to, subject, body, { replyTo: get('Email') });
- } catch (err) {
- logError(err);
- }
- }
- // Maps names to emails from the 'Team' tab (Name, Email)
- function lookupEmail(name) {
- const rows = SpreadsheetApp.getActive().getSheetByName('Team').getDataRange().getValues();
- const match = rows.find(r => r[0] === name);
- return match ? match[1] : Session.getEffectiveUser().getEmail();
- }
- function logError(err) {
- SpreadsheetApp.getActive().getSheetByName('Log').appendRow([new Date(), String(err)]);
- }
- Setup
- • In the response sheet: Extensions > Apps Script, delete the sample code, paste this, save
- • Add a Team tab (Name, Email) and an empty Log tab
- • First test: put your own email for every name in Team
- • Triggers (clock icon) > Add trigger > onRequestSubmit > From spreadsheet > On form submit
- • Authorize when asked: it needs Sheets and Gmail permission. Google shows an "unverified app" screen for your own scripts; click Advanced > Go to project
- • Submit a test form entry and check your inbox and the Log tab
- Notes
- • Unassigned requests go to the script owner, so nothing is lost
- • Gmail sending is limited per day (lower for free accounts than Workspace); fine for a few hundred requests
- • Headers are found by name, so moving columns won't break it, but renaming one will
How to do it with todo.is
- Copy the prompt and describe what should happen, the files involved and when.
- Send it in todo.is or by message; attach a CSV export of the sheet if the layout is complex.
- Your agent returns the script, the permissions it needs and setup steps.
- Paste it in Extensions > Apps Script, authorize it and add the trigger.
- Test with your own email, then ask your agent for changes ("also add a Slack message").
Tips for a better result
- Use installable triggers for anything that sends email or touches other files; simple onEdit triggers have limited permissions.
- Reading or writing a whole range at once (getValues, setValues) is far faster than cell by cell and keeps you under time limits.
- Scripts can run at most a few minutes per execution. For big jobs, ask for a version that processes in batches.
- Test with your own email address before pointing an automation at customers or colleagues.
- Some jobs don't need a script: with Google connected, a recurring todo.is to-do can read Gmail, draft replies or add Calendar events, with your approval before sending.
Google Apps Script generator: FAQ
- What is Google Apps Script? It's Google's JavaScript-based platform for automating Sheets, Docs, Gmail, Calendar, Drive and Forms. Scripts run on Google's servers, so nothing needs to be installed.
- Is Google Apps Script free? Yes, it comes with a Google account. Daily quotas apply, such as how many emails a script can send, and they're higher on Google Workspace accounts.
- Why does Google say my script is unverified? Scripts you write yourself aren't reviewed by Google, so it shows a warning when you authorize them. For your own script, choose Advanced and continue; don't do this for scripts from people you don't trust.
- Can the agent install the script in my Google account? No. It writes the code and the steps; you paste it into the Apps Script editor and authorize it yourself.
JavaScript is required to use the todo.is app.