Guides.
Every how-to and example script we've written, in one list. Each one starts from a real problem someone hit in Google Apps Script and ends with code you can paste. No hello-world, no filler.
How-tos
- Sheets · Gmail
Send bulk emails from a spreadsheet in Google Sheets
I have a column of email addresses. I want to email each one without copying them into BCC.
- Forms · Sheets · Slack
Log form submissions to a spreadsheet in Google Sheets
Every time someone submits my form, I want a row in a sheet and a Slack ping if it's urgent.
- Gmail
Auto-archive old emails on a schedule with Apps Script
I want my inbox to stop growing. Anything older than a month should fall off the front page automatically.
- Sheets
Auto-fill the date when a row is edited in Google Sheets
When I add a new entry I want the timestamp to fill itself. I'm tired of typing =NOW() and pasting as value.
- Sheets · Gmail · Drive
Export a Google Sheet to PDF and email it on a schedule
I want my Friday report mailed out without me opening a sheet. PDF attachment, three recipients, done.
- Calendar · Sheets
Sync Google Calendar events into a spreadsheet for reporting
I want my next month of meetings as rows in a sheet so I can pivot, sort, and report on them.
- Sheets · Slack
Slack a notification when a cell flips to "ready" in Google Sheets
When my team marks an item ready in the tracker, I want Slack to ping us — not me checking the sheet every hour.
- Sheets · Apps Script
Convert a column number to a letter in Google Sheets
I have a column number and I need its A1 letter so I can build a range string like 'AB1:AB100'.
- Sheets · Apps Script
Find the last row with data in a column in Google Sheets
I need the last row that has data in column C specifically, but getLastRow() keeps returning the bottom of the whole sheet.
- Sheets · Apps Script
Convert a Unix timestamp to a date in Google Sheets
I have a column of Unix timestamps from an API and I need them as readable dates in my sheet's timezone.
- Sheets · Apps Script
Copy a row to another sheet in Google Sheets
I want to move or duplicate a row from one tab to another — triggered by a status change or a button — without dragging in formatting I didn't ask for.
- Sheets · Apps Script
Get unique values from a column in Google Sheets
I need to pull every distinct value out of a column in Google Sheets without duplicates, and UNIQUE() alone is not cutting it because I need the result in a script.
- Sheets · Apps Script
Split a full name into first and last columns in Google Sheets
I have a column of full names and need to split them into separate first and last name columns without mangling names like "Mary Jo Smith" or "Jean-Pierre Dupont."
- Sheets · Apps Script
Sum a column by a matching value in Google Sheets
I want to total up numbers in one column only where the adjacent label column matches a specific value, and I want to do it without a formula that breaks when my data grows.
- Sheets · Apps Script
Freeze the header row in Google Sheets
I want to freeze the first row of my spreadsheet so the column headers stay visible when I scroll down, and ideally make it obvious that row is the header.
- Sheets · Apps Script
Highlight duplicate values in Google Sheets
I want to automatically highlight every cell that contains a duplicate value in a column or range, without the script timing out on a sheet with thousands of rows.
- Sheets · Apps Script
Clear a range but keep formatting in Google Sheets
I need to reset the data in a range every week but I keep losing the formatting I spent time setting up.
- Sheets · Apps Script
Delete empty rows in Google Sheets
I have a spreadsheet full of empty rows scattered through the data and I want to remove all of them at once without clicking through them manually.
- Sheets · Apps Script
Move a row to another sheet on edit in Google Sheets
I want to automatically move a row to another sheet the moment I mark it Done, without manually cutting and pasting or running a script by hand.
- Sheets · Apps Script
Insert a timestamp when a row is added in Google Sheets
I want to record exactly when a row was first created in my spreadsheet, not when it was last touched.
- Sheets · Apps Script
Remove duplicate rows in Google Sheets
I have a Google Sheet with duplicate rows and I want to remove them programmatically, either on demand or on a schedule, without destroying the rest of my data.
- Sheets · Apps Script
Create a named range in Google Sheets
I keep hardcoding A1 addresses in my Apps Script and they break silently when someone inserts a row.
- Drive · Apps Script
Share a Drive file with a specific user in Google Drive
I want to programmatically share a Google Drive file with a specific person's email address from Apps Script, and I'm not sure whether to use addEditor, setSharing, or something else entirely.
- Drive · Apps Script
Move a file to another folder in Google Drive
I want to write an Apps Script that moves a Google Drive file into a different folder without duplicating it or leaving it in the original location.
- Sheets · Apps Script
Set a dropdown list from a range in Google Sheets
I want to create a dropdown validation rule in Google Sheets via Apps Script that reads its options from a live range, so the list updates automatically when I add new items.
- Sheets · Apps Script
Alternate row colors with a script in Google Sheets
I want to stripe alternating row colors in my Google Sheet without manually painting every other row, and without the banding API re-flowing my colors whenever I insert or delete rows.
- Sheets · Apps Script
Sort a sheet by multiple columns in Google Sheets
I need to sort a Google Sheet by more than one column from a script, and I keep getting the wrong rows sorted or the wrong order.
- Sheets · Apps Script
Append a row to the top of a sheet in Google Sheets
I want to add a row of data to the top of my sheet so the most recent entry appears first, but appendRow keeps writing to the bottom.
- Sheets · Apps Script
Find and replace across a sheet in Google Sheets
I need to programmatically find and replace a string across my whole Google Sheet without manually opening the Find & Replace dialog every time.
- Sheets · Apps Script
Count cells by background color in Google Sheets
I need to count how many cells in a column share the same background color, and the built-in COUNTIF has no color argument.
- Docs · Apps Script
Find and replace text in a Google Doc in Google Docs
I want to programmatically find and replace text in a Google Doc using Apps Script, but my replacements are matching the wrong characters because I forgot replaceText takes a regex.
- Sheets · Apps Script
Protect a range from editing in Google Sheets
I want to lock a specific range in my Google Sheet so collaborators can't accidentally overwrite formulas or reference data, and I want to do it programmatically so I don't have to repeat the UI clicks every time the sheet is re-created.
- Sheets · Apps Script
Copy values only without formulas in Google Sheets
I want to copy a range in Google Sheets and have the destination contain the computed results, not the original formulas.
- Docs · Drive · Apps Script
Generate a doc from a template with placeholders in Google Docs
I want to fill a Google Doc template with data from a script without destroying the original template each time I run it.
- Sheets · Apps Script
Add a checkbox to a cell in Google Sheets
I want to programmatically insert a checkbox into a Sheets cell and react to it being checked or unchecked, without clicking through the Insert menu by hand.
- Gmail · Apps Script
Send an email with an attachment in Gmail
I want to send an email from Apps Script that includes a file from Google Drive as an attachment, but the attachment never shows up in the message.
- Forms · Gmail · Apps Script
Email a summary when a form is submitted in Google Forms
I want to receive an email with the submitted answers every time someone fills out my Google Form, without checking the responses tab manually.
- Sheets · Calendar · Apps Script
Create a calendar event from a spreadsheet row in Google Calendar
I want to turn rows in a Google Sheet into Calendar events without ending up with duplicate events every time the script runs.
- Sheets · Apps Script
Convert text to uppercase in a range in Google Sheets
I want to uppercase all the text in a column or selection without retyping or adding a helper column full of UPPER() formulas.
- Gmail · Apps Script
Label emails matching a search query in Gmail
I want to bulk-label a set of emails matching a Gmail search string without clicking through hundreds of threads by hand.
- Calendar · Apps Script
Add a guest to a calendar event in Google Calendar
I need to programmatically add one or more guests to an existing Google Calendar event without manually editing each event in the UI.
- Gmail · Apps Script
Count unread emails by label in Gmail
I want to read the unread count for a specific Gmail label in Apps Script without looping through every thread.
- Drive · Apps Script
List all files in a folder in Google Drive
I want to write an Apps Script that lists every file inside a Drive folder, but I'm getting only some of the files back and can't figure out why subfolders are missing.
- Drive · Apps Script
Create a Drive folder only if it doesn't exist in Google Drive
I want to create a Google Drive folder in Apps Script but only if it doesn't already exist, so repeated runs don't pile up duplicates.
- Gmail · Apps Script
Create a draft reply in Gmail
I want to programmatically draft a reply to an email and have it appear in the same thread, not as a new conversation.
- Gmail · Drive · Apps Script
Save Gmail attachments to a Drive folder in Gmail
I need to automatically pull file attachments out of Gmail and store them in a Drive folder without manually saving each one.
- Sheets · Apps Script
Generate a sequential ID for new rows in Google Sheets
I want every new row in my sheet to get a unique sequential ID, but concurrent form submissions keep assigning the same number to two rows at once.
- Sheets · Apps Script
Transpose a range with a script in Google Sheets
I want to rotate rows into columns (or vice versa) programmatically so I can automate a report layout without doing it by hand every time.
- Gmail · Apps Script
Forward matching emails automatically in Gmail
I want emails matching a specific sender or keyword to be forwarded to another address automatically, without babysitting my inbox.
- Docs · Apps Script
Append a table to a Google Doc in Google Docs
I want to programmatically insert a table into a Google Doc using Apps Script without manually formatting cells one by one.
- Calendar · Apps Script
List today's calendar events in Google Calendar
I want to write an Apps Script that logs or processes every calendar event happening today, and I keep getting incomplete results.
- Forms · Apps Script
Clear all responses from a form in Google Forms
I need to wipe all collected responses from a Google Form before re-running a survey or event registration, and I want it done in one script rather than clicking through the UI every time.
- Sheets · Apps Script
Hide rows based on a cell value in Google Sheets
I need a script that hides every row where a specific column contains a given value, without manually filtering or hitting the 30-second execution limit on big sheets.
- Gmail · Apps Script
Mark emails as read by search in Gmail
I want to run a Gmail search and mark all matching threads as read without burning through my script quota by looping over individual messages.
- Forms · Apps Script
Build a pre-filled form URL in Google Forms
I want to generate a Google Form link that already has certain fields filled in, so the person who opens it only needs to review and submit.
- Sheets · Apps Script
Duplicate a sheet tab and rename it in Google Sheets
I want to copy an existing sheet tab and give the copy a specific name without the script crashing or leaving a stray "Copy of" tab behind.
- Sheets · Apps Script
Copy a sheet to another spreadsheet in Google Sheets
I need to programmatically copy a sheet tab from one spreadsheet to another and control what the tab is named after the copy lands.
- Sheets · Gmail · Apps Script
Send email reminders based on dates in Google Sheets
I want to automatically send email reminders when a date in my Google Sheet matches today, but my comparisons keep firing a day early or not at all.
- Calendar · Apps Script
Create a recurring event in Google Calendar
I want to programmatically create a repeating event in Google Calendar from Apps Script without it running forever.
- Sheets · Apps Script
Add a custom menu in Google Sheets
I want a custom menu in my Google Sheet so I can run a script with one click instead of opening the script editor every time.
- Sheets · Apps Script
Combine multiple tabs into one sheet in Google Sheets
I have data split across multiple tabs and I want to merge it all into one sheet without copying rows by hand every time the source tabs change.
- Calendar · Apps Script
Delete events in a date range in Google Calendar
I need to delete a batch of calendar events that fall between two specific dates without clicking through each one manually.
- Sheets · Apps Script
Find the row number of a matching value in Google Sheets
I need to locate the row number of a specific value in a Google Sheet column from Apps Script so I can read, overwrite, or delete that row programmatically.
- Forms · Sheets · Apps Script
Populate a form dropdown from a spreadsheet in Google Forms
I want to pull a list from a spreadsheet column and use it as the choices in a Google Forms dropdown, without manually updating the form every time the list changes.
- Drive · Sheets · Apps Script
Convert Excel files to Google Sheets in Google Drive
I have .xlsx files sitting in Drive and I want to convert them to Google Sheets format programmatically so I can run scripts against them without wrestling with import dialogs every time.
- Sheets · Gmail · Apps Script
Send an email when a cell value changes in Google Sheets
I want to get an email automatically when a specific cell in my spreadsheet changes, without having to check it manually.
- Sheets · Apps Script
Delete rows containing a specific value in Google Sheets
I need to delete every row in my sheet that contains a specific value, without manually hunting them down one by one.
- Workspace · Apps Script
Run a script every day at a set time with Apps Script
I want to schedule a Google Apps Script function to run automatically at a specific time every day without having to trigger it manually.
- Sheets · Apps Script
Change the date format of a column in Google Sheets
I need to reformat dates in a Sheets column from script so the output looks right and my other formulas still work.
- Sheets · Apps Script
Import JSON from an API in Google Sheets
I want to pull live JSON data from an API endpoint directly into a Google Sheet without installing an add-on.
- Docs · Drive · Apps Script
Convert a Google Doc to PDF in Google Docs
I want to programmatically export a Google Doc as a PDF and save it to Drive, ideally triggered by a script that also modifies the document first.
- Forms · Apps Script
Close a form automatically at a deadline in Google Forms
I want my Google Form to stop accepting responses at a specific date and time without me having to remember to close it manually.
- Gmail · Apps Script
Send an HTML email in Gmail
I want to send an email from Apps Script that shows formatted HTML instead of raw markup, but I'm not sure where to put the HTML or why my tags are showing up as literal text.
- Sheets · Apps Script
Automatically sort a sheet on edit in Google Sheets
I want my Google Sheet to re-sort itself the moment I change a cell, without me having to click Data > Sort every time.
- Drive · Apps Script
Rename multiple files at once in Google Drive
I need to rename a large batch of Google Drive files that share a naming pattern, without clicking through each one manually.
- Sheets · Apps Script
Fill a formula down an entire column in Google Sheets
I want to programmatically fill a formula down a column in Google Sheets, stopping at the last row that has data, and have row references shift correctly the way drag-fill does.
- Sheets · Apps Script
Append a row from a web request with Apps Script
I want to POST JSON from my app (or a form) to a Google Apps Script Web App URL and have it append a row to a Sheet automatically.
- Forms · Gmail · Apps Script
Email the respondent after form submission in Google Forms
I want Google Forms to automatically send a confirmation email to whoever just submitted my form, without me doing anything manually.
- Sheets · Drive · Apps Script
Export a single sheet as a PDF in Google Sheets
I want to export only one specific tab from my Google Sheets file as a PDF, not the entire workbook.
- Drive · Apps Script
Save a file from a URL in Google Drive
I want to download a file from an external URL and store it in a Google Drive folder from an Apps Script, but every file ends up named "untitled" with a wrong type.
- Sheets · Apps Script
Protect a sheet except specific cells in Google Sheets
I want to lock my whole sheet so nobody can accidentally edit formulas or headers, but leave a few input cells open for data entry.
- Sheets · Apps Script
Split comma-separated values into rows in Google Sheets
I have a column where each cell holds multiple comma-separated items and I need each item on its own row without doing it by hand.
- Sheets · Apps Script
Color a row based on a cell value in Google Sheets
I want to highlight an entire row automatically when a status cell says "Done" (or any other value), but my conditional formatting rule keeps coloring only one cell instead of the whole row.
- Sheets · Apps Script
Record who edited a row in Google Sheets
I need to know which team member changed a row in my shared spreadsheet, but the built-in revision history doesn't show it per-cell.
- Sheets · Apps Script
Sort sheet tabs alphabetically in Google Sheets
I have a workbook with dozens of tabs and I want to sort them alphabetically without dragging each one by hand.
- Slides · Sheets · Apps Script
Create a slide for each row in Google Slides
I have a spreadsheet with 40 rows of data and I need a separate Google Slide for each one without building every slide by hand.
- Gmail · Apps Script
Delete emails older than 30 days in Gmail
I need a script that automatically clears out emails older than 30 days so my inbox stops accumulating years of noise.
- Sheets · Apps Script
Trim whitespace from every cell in Google Sheets
I pasted data from a website or PDF into Sheets and now TRIM() isn't removing the spaces, so sorting, VLOOKUP, and exact-match formulas keep failing.
- Sheets · Apps Script
Pull data from another spreadsheet in Google Sheets
I need to read data from a different Google Sheet file into my script without using IMPORTRANGE or manually copying ranges.
- Sheets · Gmail · Apps Script
Send personalized emails from a sheet in Gmail
I have a spreadsheet of names and email addresses and I want to send each person a personalized message from my Gmail account without copy-pasting or using a paid tool.
- Calendar · Sheets · Apps Script
Export calendar events to a sheet in Google Calendar
I want to pull all my Google Calendar events into a spreadsheet so I can filter, sort, and report on them without clicking through the calendar UI one week at a time.
- Sheets · Apps Script
Auto-resize columns to fit text in Google Sheets
I want to auto-fit column widths in Google Sheets from a script so I stop manually dragging columns after every data refresh.
- Docs · Apps Script
Merge multiple docs into one in Google Docs
I want to programmatically combine several Google Docs into one file without losing tables or list formatting.
- Sheets · Apps Script
Insert an image into a cell in Google Sheets
I want to insert an image that lives inside a cell in Google Sheets using Apps Script, not a floating image that slides around when I sort or resize.
- Gmail · Sheets · Apps Script
Log incoming emails to a sheet in Gmail
I want to automatically capture incoming Gmail messages into a Google Sheet so I can track, filter, or report on them without manually copying anything.
- Sheets · Apps Script
getValue vs getDisplayValue in Google Sheets
I want to know which method to call when reading a cell in Apps Script so my comparisons and conditional logic actually work instead of silently returning the wrong result.
- Apps Script
Cache API responses with CacheService in Apps Script
I keep hitting external API rate limits or slow fetch times inside my Apps Script project and want to cache responses so I'm not making the same call on every execution.
- Gmail · Sheets · Apps Script
Parse CSV attachments from Gmail into Google Sheets
I need a script that pulls CSV files attached to specific Gmail messages and writes their rows into a Google Sheet automatically, without corrupting quoted fields that contain commas or line breaks.
- Apps Script
Retry UrlFetchApp with exponential backoff in Apps Script
I keep hitting 429 rate-limit errors from UrlFetchApp and my script just dies instead of waiting and retrying.
- Apps Script
Store API keys with PropertiesService in Apps Script
I need to store an API key in my Apps Script project without it appearing in my source code, version history, or shared copies.
- Apps Script
Fix "Exceeded maximum execution time" in Apps Script
I'm running a script that processes a large spreadsheet and it keeps dying with "Exceeded maximum execution time" before it finishes.
- Apps Script
Simple vs installable triggers in Apps Script
I want to understand why my Apps Script trigger works fine when I run it manually but fails silently on a schedule or form submit.
- Sheets · Apps Script
getActiveSheet vs getSheetByName in Google Sheets
I wrote a script that works fine when I run it manually, but it reads the wrong sheet when triggered automatically.
- Apps Script
Fix "You do not have permission to call X" in Apps Script
I added code to onEdit or onOpen and now Apps Script throws "You do not have permission to call X" and I can't figure out why it works in the editor but breaks on the sheet.
- Gmail · Apps Script
MailApp vs GmailApp in Apps Script
I want to send email from Apps Script without granting my script full mailbox access, and I am not sure whether to use MailApp or GmailApp.
- Apps Script
Prevent concurrent runs with LockService in Apps Script
I need to stop two simultaneous form submissions from running my Apps Script trigger at the same time and corrupting my row counter or sequential invoice ID.
- Sheets · Apps Script
Create a custom function with autocomplete in Google Sheets
I want to write a formula in Google Sheets that does something built-in formulas can't, and have it show up in autocomplete like a real function.
- Sheets · Apps Script
onEdit vs onChange triggers in Google Sheets
I'm trying to figure out why my Apps Script trigger isn't firing when rows get inserted, or why I can't get a cell reference inside an onChange handler.
- Apps Script
Fix "Authorization is required to perform that action" in Apps Script
I added a new Google service to my existing Apps Script project and now every run fails with "Authorization is required to perform that action" even though I already granted permissions before.
- Sheets · Apps Script
Fix "TypeError: Cannot read properties of null" in Apps Script
I'm getting "TypeError: Cannot read properties of null (reading 'getRange')" in my Apps Script and I don't know why getSheetByName is failing.
- Sheets · Apps Script
Add a custom sidebar in Google Sheets
I want to show a custom panel alongside my spreadsheet that can read and write cell data without leaving the sheet.
- Sheets · Apps Script
Fix "The coordinates of the range are outside the dimensions of the sheet"
I'm calling setValues() or getRange() in Apps Script and getting a coordinates error because my data is larger than the sheet.
- Sheets · Apps Script
getValue vs getValues in Google Sheets
I want to stop my Apps Script from being slow when reading spreadsheet data, and I'm not sure whether to use getValue or getValues.
- Apps Script
Fix "Script function not found: doGet" in Apps Script
I deployed an Apps Script web app and got "Script function not found: doGet" even though doGet is clearly in my code.
- Sheets · Apps Script
appendRow vs setValues for adding rows in Google Sheets
I want to add rows to a Google Sheet from Apps Script without losing data or hitting quota errors, and I'm not sure whether to use appendRow or setValues.
- Sheets · Apps Script
UrlFetchApp vs IMPORTDATA for external data in Google Sheets
I want to pull data from an external URL into Google Sheets and I'm not sure whether to use the built-in IMPORTDATA formula or write an Apps Script fetch.
- Apps Script
Fix "Service invoked too many times for one day" in Apps Script
I'm hitting "Service invoked too many times for one day" in my Apps Script and need to understand why the quota resets aren't happening when I expect them and how to restructure my code to stay under the limit.
- Sheets · Apps Script
Fix "Range not found" in Google Sheets scripts
I have a script that calls getRange with a perfectly valid cell address and it throws "Range not found" at runtime, and I don't know why.
- Sheets · Apps Script
Fix "Cannot call SpreadsheetApp.getUi() from this context" in Apps Script
I am getting "Cannot call SpreadsheetApp.getUi() from this context" when my Apps Script trigger fires and I cannot figure out why it works in the editor but fails on a schedule.
- Sheets · Apps Script
Fix "The number of rows in the data does not match the number of rows in the range" in Google Sheets
I'm getting a "number of rows in the data does not match" error when I call setValues in Apps Script and I can't figure out why my range and array are out of sync.
- Sheets · Apps Script
Fix "The parameters don't match the method signature" in Apps Script
I am calling setValues on a range in Google Apps Script and it throws "The parameters don't match the method signature" even though my data looks correct.
- Sheets · Apps Script
Fix "Cannot read properties of undefined (reading 'range')" in Apps Script
I ran my onEdit function from the Apps Script editor and got "Cannot read properties of undefined (reading 'range')" — I need to understand why and how to test trigger code correctly.
- Drive · Apps Script
Fix "No item with the given ID could be found" in Apps Script
I'm getting "No item with the given ID could be found" in my Apps Script even though the file opens fine in my browser, and I need to understand why the script can't find it.
- Gmail · Apps Script
Fix "Specified permissions are not sufficient to call" in Apps Script
I set an explicit oauthScopes list in my Apps Script manifest and now my script throws "specified permissions are not sufficient to call" even though it worked before.
- Apps Script
Fix "Request failed for URL returned code 403" in Apps Script
I'm getting "Request failed for URL returned code 403" from UrlFetchApp and I can't see what the API is actually rejecting.
- Apps Script
Fix "Unexpected token < in JSON at position 0" in Apps Script
I called an external API from Apps Script and JSON.parse() threw "Unexpected token < in JSON at position 0", and I need to find out what the server actually sent back.
- Drive · Apps Script
Fix "Cannot retrieve the next object: iterator has reached the end" in Apps Script
I'm calling getFilesByName() or getFoldersByName() and my script crashes with "Cannot retrieve the next object: iterator has reached the end" even though I know the file exists.
- Sheets · Apps Script
Fix "There are too many scripts running simultaneously" in Google Sheets
I filled my custom Apps Script function down a column and now every cell shows "Loading..." or throws "There are too many scripts running simultaneously for this Google user account."
- Apps Script
Fix "The script completed but did not return anything" in Apps Script
I deployed a Google Apps Script web app and it shows "The script completed but did not return anything" instead of my page or response.
- Sheets · Apps Script
Fix "Service Spreadsheets failed while accessing document" in Google Sheets
I'm getting "Service Spreadsheets failed while accessing document with id" in my Apps Script and I can't tell if it's my code or Google's servers.
- Apps Script
Switch an old script from Rhino to the V8 runtime
I want to enable the V8 runtime on an existing Apps Script project so I can use modern JavaScript, but I am worried about breaking things that are already working.
- Apps Script
Replace Rhino for each loops with for...of
I migrated a script from Rhino to V8 and now I'm getting a syntax error on my for each loop, and I'm not sure what the safe replacement is.
- Apps Script
Fix "Identifier has already been declared" in Apps Script
I declared a constant in one .gs file, but Apps Script throws "Identifier has already been declared" and now none of my functions run.
- Sheets · Apps Script
Convert getValues for loops to map and filter
I want to rewrite my getValues for loop using map and filter so the code is shorter, but I keep getting a parameter mismatch error when I try to write results back with setValues.
- Apps Script
Destructure JSON from UrlFetchApp responses
I want to pull values out of a UrlFetchApp JSON response without writing four lines of temp variables, but I keep crashing when the API omits a nested field.
- Sheets · Apps Script
Use default parameters instead of undefined checks
I want to clean up my Apps Script functions by using default parameters instead of writing typeof checks at the top of every function, but I'm not sure why my defaults don't seem to work when called from a spreadsheet cell.
- Sheets · Apps Script
Replace object-as-dictionary lookups with a Map
I built a lookup table as a plain JS object in Apps Script, and my keys work fine most of the time, but some lookups silently return undefined even though I can see the value in the sheet.
- Sheets · Apps Script
Use a Set to skip already-processed rows
I need to skip rows I've already processed without my script timing out on large sheets.
- Sheets · Apps Script
Wrap SpreadsheetApp in a class for cleaner scripts
I keep calling SpreadsheetApp.getActiveSpreadsheet().getSheetByName() in every function and I want to consolidate that logic somewhere it can be reused without copy-pasting.
- Sheets · Apps Script
Fix dates off by one day after the V8 migration
I migrated my Apps Script project to V8 and now date cells show a day behind what my script sets, and I need to understand why and fix it without rewriting everything.
- Apps Script
Fix conditional catch clause syntax errors under V8
I migrated my script to the V8 runtime and now it fails immediately with "Unexpected token if" inside a catch block that worked fine before.
- Apps Script
Run parallel requests with fetchAll, not async/await
I want to fetch data from multiple APIs at the same time in Apps Script so my script finishes faster.
- Slides · Apps Script
Replace text placeholders across a deck in Google Slides
I need to fill a Google Slides template with dynamic values (names, dates, company fields) without manually editing every text box on every slide.
- Slides · Sheets · Apps Script
Generate certificates from a template in Google Slides
I need to auto-generate personalized certificates from a Google Slides template without getting blank PDFs.
- Slides · Drive · Apps Script
Export each slide as a PNG in Google Slides
I want to save every slide in my Google Slides deck as a PNG file in Drive, without downloading the deck manually.
- Slides · Apps Script
Set speaker notes on every slide in Google Slides
I want to programmatically set or read speaker notes on every slide in a Google Slides presentation without clicking into each slide manually.
- Slides · Apps Script
Sort slides alphabetically by title in Google Slides
I have a deck with dozens of slides and I need them in alphabetical order by title without dragging them one by one.
- Slides · Sheets · Apps Script
Insert a linked Sheets chart into a slide in Google Slides
I want to insert a chart from Google Sheets into a Slides deck via Apps Script and have it reflect updated data without re-inserting it every time.
- Forms · Apps Script
Grade a quiz with a script in Google Forms
I want to write an Apps Script that reads quiz responses and sets scores or feedback automatically, but nothing seems to save.
- Forms · Apps Script
Jump to a section based on an answer in Google Forms
I want to programmatically set up section branching in Google Forms so different answers route respondents to different parts of the form.
- Forms · Drive · Apps Script
Move uploaded files into a Drive folder in Google Forms
I want to move files uploaded through a Google Form into a specific Drive folder automatically, instead of leaving them scattered in the form's default upload location.
- Forms · Sheets · Apps Script
Route responses to different sheets by answer in Google Forms
I want to automatically send Google Form submissions to different tabs in a spreadsheet depending on what the respondent answered.
- Forms · Sheets · Apps Script
Create a form from spreadsheet data in Google Forms
I want to write an Apps Script that reads question labels and choice options from a spreadsheet and builds a Google Form automatically, without manually re-entering the data.
- Docs · Apps Script
Number the headings in a Google Doc with Apps Script
I want to automatically prefix numbered counters to every heading in my Google Doc so I do not have to maintain them by hand every time I add or move a section.
- Sheets · Apps Script
Force a custom function to recalculate in Google Sheets
I wrote a custom Apps Script function but it keeps returning a stale value even after the underlying data it reads changes.
- Sheets · Apps Script
Get a spreadsheet's ID from its URL or the active file
I need the spreadsheet ID so I can open or reference a specific Google Sheet in my Apps Script code, either the file I'm already editing or one I only have a URL for.
- Sheets · Apps Script
Work with multiple ranges at once using getRangeList
I want to apply the same formatting or clear several non-contiguous ranges in one shot without looping through each one individually.
- Apps Script
View logs and debug an Apps Script (where Logger.log actually goes)
I ran Logger.log in my Apps Script but I cannot find the output anywhere — no popup appeared, no console opened, and I do not know where to look.
- Sheets · Apps Script
Generate a unique ID for each row in Google Sheets
I need each row in my sheet to get a stable, unique ID when data is added, and I need it to stay put even if I run the script again.
- Apps Script
Persist global state across runs with PropertiesService
I want a variable in my Apps Script project to remember its value between separate trigger runs, but it keeps resetting to the default every time my script executes.
- Sheets · Apps Script
Get driving distance between two addresses in Google Sheets
I want a custom Sheets formula that returns the driving distance between two address cells without leaving the spreadsheet or hitting a paid API.
- Sheets · Apps Script
Convert a date between timezones (with DST) in Google Sheets
I have a timestamp in one timezone and need to display it correctly in another, without my formula breaking twice a year when clocks change.
- Drive · Apps Script
Extract a Drive file ID from any share URL
I have a Google Drive share URL in a spreadsheet cell and I need the raw file ID so I can call DriveApp or the Drive API from Apps Script.
- Apps Script
Test an onEdit or onFormSubmit trigger without waiting for the event
I want to run my onEdit or onFormSubmit handler right now, without actually editing a cell or submitting a form, so I can see whether the logic works.
- Gmail · Apps Script
Run a script when a new email arrives in Gmail
I want my Apps Script to automatically run whenever a new email arrives in my Gmail inbox, without clicking anything manually.
- Docs · Apps Script
Convert Markdown text into a formatted Google Doc
I have a block of Markdown text and I want to paste it into Google Docs without manually reformatting every heading and bold span.
- Sheets · Apps Script
Add a hyperlink to part of a cell's text in Google Sheets
I want to make one word or phrase inside a cell clickable without turning the entire cell into a hyperlink.
- Sheets · Apps Script
Read a column by its header name, not its index
I want to look up a column's position by its header text so adding a column to my sheet doesn't break every getRange call in my script.
- Drive · Apps Script
Build a direct download link for a Drive file with Apps Script
I'm sharing a Drive file from a script and the link I'm generating opens a preview instead of downloading the file.
- Apps Script
Keep a stable web app URL across deployments
I want my Apps Script web app URL to stay the same after I push changes, because every new deployment hands me a different URL and breaks bookmarks and integrations that saved the old one.
- Sheets · Apps Script
Check whether a cell contains a substring in Google Sheets
I need to find rows in a sheet where a cell contains a particular word or phrase, and do something with them from an Apps Script.
- Gmail · Apps Script
Use negative (NOT) search operators in Gmail with Apps Script
I want to filter Gmail threads in Apps Script by excluding certain senders, labels, or states without manually checking each thread in a loop.
- Apps Script
Pause a script with Utilities.sleep (and when not to)
I need to add a delay between API calls in my Apps Script so I stop hitting rate-limit errors, and I want to know how much sleep I can afford before it costs me my whole execution window.
- Sheets · Apps Script
Pull data from a web page into Google Sheets with Apps Script
I want to pull a specific number or piece of text off a public web page and write it into my spreadsheet automatically, without setting up a server or buying an API.
- Apps Script
Delete all triggers for a project with Apps Script
I need to delete all triggers in my Apps Script project because my setup function keeps creating duplicates every time I run it, and I've hit the 20-trigger-per-script cap.
- Sheets · Apps Script
Apply conditional formatting rules with a script in Google Sheets
I want to add a conditional formatting rule to a Google Sheet from a script without deleting the rules that are already there.
- Drive · Apps Script
Copy files from one Drive folder to another with Apps Script
I need to copy all files from one Google Drive folder into another without doing it by hand, and without creating duplicates if I run the script more than once.
- Apps Script
Get the active user's email in Apps Script (and why it's sometimes blank)
I called Session.getActiveUser().getEmail() in my onFormSubmit trigger and got an empty string, and I can't figure out why.
- Drive · Apps Script
Sort Drive files by created or modified date with Apps Script
I need to process my Google Drive files in date order but the DriveApp iterator gives me files in an unpredictable sequence I can't control.
- Sheets · Apps Script
Unpivot a wide table into long rows in Google Sheets
I have a wide table with one row per entity and a column per month (or category), and I need to reshape it into a long format with one row per measurement so I can filter, chart, or import it properly.
- Apps Script
Create a time-driven trigger from code with ScriptApp
I want to install a recurring time-driven trigger from code so I don't have to click through the Apps Script UI every time I deploy.
- Gmail · Apps Script
Send an email with an inline image in Gmail
I want to send a Gmail message from Apps Script where an image appears inside the email body, not as a file attachment the recipient has to open separately.
- Sheets · Apps Script
Set a cell's number, date, or currency format with a script
I want to format cells in Google Sheets from a script — apply currency symbols, date patterns, or decimal places — without having to click through the Format menu every time.