StepGleam logoStepGleam
Coding guide

Edit Google Apps Script locally with Claude Code and clasp push

Clone an Apps Script project with clasp, open Claude Code in that folder, describe the change in plain English, review the diff against your existing patterns, then clasp push — the same loop jlhernando uses for SEO reporting scripts.

~35 minIntermediate 86/100 4 steps Updated Nov 1, 2026
Claude CodeclaspGoogle Apps Script
Edit Google Apps Script locally with Claude Code and clasp push — illustration for this Coding guide

Tools used

  • Claude CodeReads the local Apps Script project and drafts changes that match existing patterns
  • claspClones the Apps Script project locally and pushes reviewed edits back
  • Google Apps ScriptRuntime for the Sheets/BigQuery automation Hernando maintains
Step navigator0/4 done
0 of 4 steps done
What you'll get

A local clasp checkout you can edit with Claude Code, a reviewed change that matches your existing helpers/menus, and a successful clasp push back to the Apps Script project.

Who this is for

SEOs and automation folks who already have Apps Script projects and want a local Claude Code workflow instead of the web editor.

Read this first

Before you start

José Luis Hernando (jlhernando, 15 Jan 2026) maintains ~1,500-line Apps Script SEO reporters that query BigQuery Bulk Export, build weekly trend sheets, and email exec summaries. The browser editor was too painful to stay in; clasp + Claude Code became his loop: clone once, describe the gap, review, push. This guide follows his post only. His exact Script IDs, SQL builders, and full catchUpMissingWeeks source stay unpublished gaps.

Step-by-step instructions

Step 1 of 4 · Coding

Clone the Apps Script project once with clasp

Hernando's new workflow step 1: clone locally with your IDE (he mentions VS Code) using clasp clone <scriptId> — only needed once per project. Find the Script ID in the Apps Script editor under Project Settings.

Edit Google Apps Script locally with Claude Code and clasp push — guide thumbnail
Why this works

Without a local checkout Claude Code cannot read your real helpers and menus.

Step 2 of 4 · Coding

Open Claude Code in the project folder and describe the gap in plain English

Step 2–3 in his loop: open Claude Code in the project directory with claude, then describe what you want. Real example after holidays: Week 1 of 2026 was missing from the weekly reporter, so he asked for a function that checks for missing weeks and starts from the gap. Within a minute Claude Code had read Code.js, understood ISO weeks / BigQuery / trend sheets, written catchUpMissingWeeks(), and added it to the menu — reusing his existing backfillTrendWeeks() pattern and toast style.

Copy-ready promptClaude Code
I'm starting this in week 2 of Jan, can I have a function that checks if weeks are missing and starts from the week missing?
Why this works

Plain-English gaps beat hand-writing BigQuery date SQL in the web editor.

Step 3 of 4 · Coding

Use it to debug mismatches you notice after a run

After catch-up he saw data out to column AK while headers only reached Y. He told Claude Code; it compared getTrendHeader() (25 columns) to newer SQL output (37 columns), found missing Brand / Non-brand Impressions headers, and fixed the header array — work he estimates at ~20 minutes of manual counting.

Copy-ready promptClaude Code
I'm getting data until AK column but headers until Y column - check what's the problem
Why this works

Describe the symptom; let it cross-check your header helper against the SQL aliases.

Step 4 of 4 · Coding

Review the diff, then clasp push — tips he actually uses

Final step: review and clasp push. His getting-started tips: be specific about the stack (or /init); let it read before it writes; paste errors for debugging; trust but verify, especially before anything that touches production data. For complex features he asks Claude Code to plan first; for quick fixes he just describes the problem.

Why this works

Push without review is how production Sheets get a confident wrong header row.

End of guide · Reviewed Nov 1, 2026

Pro tips2
  • Tell Claude the stack up front (Apps Script + BigQuery) or run /init so it stops guessing APIs.
  • Let it read the file before it writes — Hernando says interrupting that read costs context.
Common mistakes2
  • clasp push without reviewing — he still treats production data scripts as trust-but-verify.
  • Asking for a feature without mentioning existing helpers; Claude Code matched his backfillTrendWeeks pattern only because it read the repo.
FAQ2
Is this only for SEO scripts?
No. Hernando's examples are SEO reporters, but the clasp clone → Claude Code → clasp push loop is the same for any Apps Script project you maintain.
Do I need the Apps Script web editor afterward?
Only for Script ID / Project Settings on first clone, and for anything clasp cannot do in your setup. Day-to-day edits stay local in his workflow.