Create custom functions with Apps Script

Create custom functions with Apps Script in Google Sheets — with the four heights of help laid out: do it now, make it easier for the next person to accept, work out the right move when you are stuck, and learn the pattern so it stops coming back.

4prompt heights
Open it in the interactive atlas →

The four heights

The same task, four distances: today's deadline, the next reviewer, the stuck moment, the pattern.

Execute — do the immediate task

+
I need three custom functions written in Apps Script for our weekly reports: one to fetch the…
I need three custom functions written in Apps Script for our weekly reports: one to fetch the latest revenue per customer from the Sales sheet, one to parse dates in free-text cells into YYYY-MM-DD, and one to return the current fiscal quarter given a date. Deploy them as project-level functions, add short JSDoc comments, and run a smoke test on Sheet 'Weekly Report' cell B2, C2, and D2 respectively. Stop and report if any authorization or runtime error occurs.

Improve — make it easier to accept

+
Before I hand these scripts to the product analyst team, make them easy to use: surface example…
Before I hand these scripts to the product analyst team, make them easy to use: surface example inputs and outputs at the top of the script, document expected sheet and range names, flag places that will break on missing columns or unexpected date formats, and add one guard that returns blank instead of throwing for empty cells. Also suggest a one-line name change if a function name is unclear to non-developers.

Decide — diagnose the stuck moment

+
I pasted a script from Stack Overflow into our project and ran the custom function in Weekly Report…

I just pasted a community script and it crashes on first run

I pasted a script from Stack Overflow into our project and ran the custom function in Weekly Report B2; it threw Authorization required and then a TypeError on getRange. Priya in product expects the file to be safe and usable by Friday; I cannot tell if the script needs additional scopes, relies on a sheet that doesn't exist, or if the runtime error is from different column names. What is the likely diagnosis and the safest next steps to make it runnable without breaking other users?

Become — change the pattern

+
Across five projects this quarter we've rewritten similar Apps Script functions to fetch latest…

We keep rebuilding small utility functions for every report

Across five projects this quarter we've rewritten similar Apps Script functions to fetch latest metrics, parse dates, and map quarters. It wastes time and causes inconsistent naming and broken deployments. Which habits should we change, what reusable structure or repo would stop the churn, and how do we version and share a single vetted script so analysts can adopt it without risking authorization or sheet-name assumptions?

Next to this one

Other spreadsheet work people do in Google Sheets.

Every task here came from the work, not from a feature list — which is why the prompts name what you want done and never the button that does it. The tool changes; the work does not.
Copyright © LLOS.ai · 2026 — original pedagogy, voice, and design — all rights reserved.

The rest of the map

Same library, five ways in.