# 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.

- **Category:** [Coding](https://stepgleam.com/categories/coding)
- **Difficulty:** Intermediate
- **Time:** ~35 minutes
- **Tools:** Claude Code, clasp, Google Apps Script
- **Reliability score:** 86/100
- **Steps:** 4
- **Last updated:** 2026-11-01
- **Published:** 2026-11-01

## Tools used

- [Claude Code](https://code.claude.com/docs/en/overview) — Reads the local Apps Script project and drafts changes that match existing patterns
- [clasp](https://github.com/google/clasp) — Clones the Apps Script project locally and pushes reviewed edits back
- [Google Apps Script](https://developers.google.com/apps-script) — Runtime for the Sheets/BigQuery automation Hernando maintains

## 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.

## 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.

## Steps

### Step 1: Clone the Apps Script project once with clasp

**Tool:** 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**.

**Why this works:** Without a local checkout Claude Code cannot read your real helpers and menus.

[Open step 1](https://stepgleam.com/guides/edit-google-apps-script-with-claude-code-and-clasp#step-1)

### Step 2: Open Claude Code in the project folder and describe the gap in plain English

**Tool:** Claude Code

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.

**Why this works:** Plain-English gaps beat hand-writing BigQuery date SQL in the web editor.

**Prompt:**

```
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?
```

[Open step 2](https://stepgleam.com/guides/edit-google-apps-script-with-claude-code-and-clasp#step-2)

### Step 3: Use it to debug mismatches you notice after a run

**Tool:** Claude Code

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.

**Why this works:** Describe the symptom; let it cross-check your header helper against the SQL aliases.

**Prompt:**

```
I'm getting data until AK column but headers until Y column - check what's the problem
```

[Open step 3](https://stepgleam.com/guides/edit-google-apps-script-with-claude-code-and-clasp#step-3)

### Step 4: Review the diff, then clasp push — tips he actually uses

**Tool:** clasp

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.

[Open step 4](https://stepgleam.com/guides/edit-google-apps-script-with-claude-code-and-clasp#step-4)

## Pro tips

- 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 mistakes

- 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.

## FAQ

### 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.

---

Canonical guide: https://stepgleam.com/guides/edit-google-apps-script-with-claude-code-and-clasp
Read this guide as Markdown: https://stepgleam.com/guides/edit-google-apps-script-with-claude-code-and-clasp.md
