What this is
Google has a built-in place for small programs called Apps Script. A program there can read your Gmail, build a Slides deck, sort a Sheet, or read a Doc, using the same permissions you already have.
An AI assistant can write those programs for you. The normal way to hand them to Google is a tool called clasp. Many school districts block it. This guide shows the way that still works: you make a key that belongs to you, and the AI uses your key.
- Never type or paste student names, emails, or work into an AI chat. The program reads them inside Google. The AI only writes the program.
- Follow your district's rules on AI and student data. This guide does not turn off anything IT has locked. It only uses permissions you already have.
Words you'll see
- AI assistant
- A program you talk to in plain English. This guide uses Claude.
- Claude Code
- A version of Claude that can create files and run things on your computer.
- Terminal
- The text window inside Claude Code where you type a command and press Enter.
- Node.js
- A free program that runs the two small helper files. You install it once and forget it.
- Google Cloud
- Google's settings site for developers. You'll visit it once to make your key.
- Key
- A small file that proves a program is acting for you. Keep it private, like a password.
Two ways to do this
Way 1: no setup
5 minutes, works today
- Ask Claude (at claude.ai) to write the program. Say what you want in plain words.
- Go to script.google.com in your school account. Click New project. Paste the code. Click the save icon.
- Click Run. Google asks you to allow permissions once. Allow them.
Good for one-off scripts. The downside: every fix means copying code back and forth.
Way 2: one-time setup, then hands-free
About an hour, once. Easier with a colleague next to you.
After the setup below, you just describe what you want. Claude Code writes the program, sends it to Google, and gives you a link. You click Run. That's the whole routine.
The one-time setup, in 8 steps
Do these in order. Stay signed in to your school Google account the whole time. Every step ends with a "you did it when" check, and a box you can tick to keep your place.
Install two free programs
About 10 minutes
- Go to nodejs.org. Click the big download button marked LTS. Open the download and click Next until it finishes.
- Go to claude.com/claude-code. Get the desktop app. Install it and sign in.
Claude Code opens. In its terminal, type node --version and press Enter. You see a number like v22.11.0.
Make a Google Cloud project
About 5 minutes
- Go to console.cloud.google.com. Check the little picture in the top-right corner is your school account.
- At the top, click the project name (or Select a project). Click New project. Name it my-scripts. Click Create.
- Open the menu (three lines, top-left). Click APIs & Services, then Library.
- In the search box type Apps Script API. Open it. Click Enable.
The Apps Script API page shows a button that says Manage instead of Enable.
It says my organization doesn't allow this
Some districts turn Google Cloud off for teachers. If you see that message, stop here and use Way 1. The ask for IT is small: "please let teachers create Google Cloud projects."
Make your key
About 10 minutes
- Open the menu (three lines). Click Google Auth platform.
- Click Branding, then Get started. App name: My key. Support email: yours. Audience: choose Internal. Contact email: yours. Tick the agreement. Click Create.
- Click Clients, then Create client. Application type: Desktop app. Name: laptop. Click Create.
- Click Download JSON. A file lands in your Downloads folder.
- Open Claude Code and paste this:
Find the file that starts with client_secret in my Downloads folder. Move it into a new folder called .config/gas-oauth inside my home folder, and rename it to exactly client_secret.json. Then tell me the full path where it is now.
Claude Code tells you the file is at a path ending in .config/gas-oauth/client_secret.json.
It is your key. Don't email it, don't paste it into a chat, don't put it in a shared drive. If it ever gets out, go back to Clients, delete it, and make a new one.
I don't see "Internal" as a choice
That means the browser is signed in to a personal Gmail, not the school account. Switch accounts (top-right picture) and try again. Internal is only offered inside a school or workplace Google.
Turn on one switch
1 minute
- Go to script.google.com/home/usersettings.
- Turn Google Apps Script API to On.
The switch says On.
Get the two helper files
2 minutes
Two small files do the work. You don't need to open them. Paste this into Claude Code:
Make a folder called gas-ai-kit in my home folder. Download these two files into it, keeping their names: https://guides.letsharkness.com/apps-script/kit/auth.js https://guides.letsharkness.com/apps-script/kit/push.js Then list the folder so I can see both files.
Prefer to do it by hand? Download them here and put both in a folder called gas-ai-kit in your home folder: auth.js push.js
Claude Code lists auth.js and push.js inside gas-ai-kit.
Sign in once
5 minutes
- In Claude Code's terminal, type this and press Enter:
node ~/gas-ai-kit/auth.js
- It prints a long web link. Copy the link and open it in a browser where your school account is signed in.
- Click Allow.
- The browser now shows an error page about localhost. This is expected. The page fails on purpose; what matters is its address.
- Click in the address bar, select the whole address (it starts with
http://localhost/?), and copy it. - Go back to the terminal. Paste the address where it says Paste the address. Press Enter.
The terminal says Saved … token.json. Done. You will not have to do this again.
Google says "Access blocked" or "app isn't verified"
Two usual causes. The browser is on a personal Gmail instead of the school account, or in Step 3 the Audience was set to External. Fix that, then run the command in Step 6 again.
Test it
5 minutes
Paste this into Claude Code:
Make a folder called hello-script in my home folder. Inside it create gas.json containing {"title": "Hello from my laptop"}, and a folder gas with two files: appsscript.json (timeZone America/New_York, runtimeVersion V8, exceptionLogging STACKDRIVER) and Code.gs with one function named hello that logs the words "It works" using Logger.log. Then run the command: cd ~/hello-script && node ~/gas-ai-kit/push.js
Show me the link it prints.- Open the link Claude Code gives you. This is a real Apps Script project that came from your laptop.
- At the top, make sure the dropdown says hello. Click Run.
- Google asks for permission the first time. Allow it.
The log at the bottom of the page says It works.
Claude Code says it worked, but I don't see the project
Look at the account picture in the top-right corner of the Apps Script page. If it's a personal Gmail, switch to the school account. The project is there. This is the most common hiccup.
Teach Claude Code the routine
2 minutes
Claude Code reads a notes file called CLAUDE.md every time it starts. Give it the routine once and you never have to explain again. Paste this:
Add this to the CLAUDE.md file in my home folder (create it if it doesn't exist):
# My Google Apps Script routine
I am a teacher. My school blocks clasp, so we push scripts with my own key.
- Each script lives in its own folder with gas.json ({"title": ...}) and a gas/ folder (appsscript.json + Code.gs).
- To send a script to Google, run inside that folder: node ~/gas-ai-kit/push.js
The first push creates the project and saves its link in gas.json.
- My key files are in ~/.config/gas-oauth/. Never show, copy, or move them.
- I run scripts from the Apps Script editor's Run menu, which only runs functions with no inputs. Always give me a preview function that shows what a script WOULD do before the one that does it.
- List the permissions a script needs in gas/appsscript.json, using the exact ones Google's Apps Script reference names for each service.
- Never put student names, emails, or work into our chat or into code. Scripts may read them inside Google. You may not.
- After every push, give me the editor link and tell me which function to run first.You start a new chat, ask for a script, and Claude Code builds it, sends it, and gives you the link without being told how.
Now ask for real things
From here on, you describe. Say where the information is and what you want out. Three examples that work:
"Find every email from @students.myschool.org in the last two weeks that has a photo attached. Make one Slides deck with one photo per slide and the student's name and email under it. Group the slides by class section using this roster doc: (paste the link). Give me a preview function first."
"Read the Google Sheet at (link). For every row where the Status column says Late, draft (don't send) a short email to the address in column C reminding them of the due date in column D."
"Every Friday at 3 pm, send me an email listing the Google Docs shared with me this week that I haven't opened."
- Ask for a preview. "Show me what it would do before it does it." You run the preview first.
- Ask for a receipt. "Email me the link and the counts when it finishes."
- Describe documents, don't paste them. "The roster is a Doc with one tab per class." The program reads it inside Google.
- When it breaks, paste the exact message. Copy the red text from the Apps Script page into Claude Code. The fix is usually one line.
If something goes wrong
| What you see | What to do |
|---|---|
| "User has not enabled the Apps Script API" | Do Step 4. Then try again. |
| "Access blocked" or "This app isn't verified" | Sign in to the school account, not personal Gmail. Check Step 3 chose Internal. Run Step 6 again. |
| The push worked but the project isn't in my list | Switch to the school account (top-right picture). |
| "Specified permissions are not sufficient" | Paste that message into Claude Code. It adds the missing permission and sends the script again. Click Run and allow it. |
| The Run menu doesn't show my function | Ask Claude Code: "Give this function a version with no inputs." |
| The script stops after about 6 minutes | Google's limit per run. Ask Claude Code: "Make it save its place and continue by itself." |
| I want to turn all of this off | Go to myaccount.google.com/permissions and remove the app. Your scripts keep working; your laptop just can't send new ones. |
Get a hand
Steps 2 and 3 are the fiddly ones. If you can, do them next to someone who has done it before, or share this page with a colleague and do it together over a planning period. Once the key is made, the rest is copy, paste, click.
Want to know why each step works, or what each file does? Read the detailed version.