Spreadsheet × GAS Integration — Collaboration Tips with Claude Code

Handle spreadsheet processing with GAS, maintain consistency with Claude Code

SpreadsheetGASClaude CodeIntegrationAutomation
4 min read

Introduction

There are many scenarios where you want to integrate web applications with spreadsheets. "Export sales data to a spreadsheet," "display spreadsheet data on a site"—needs vary widely.

This article introduces tips for creating spreadsheet-side processing with Google Apps Script (GAS) while collaborating with Claude Code.

Why Use GAS?

There are several ways to integrate with spreadsheets, but processes that complete within the spreadsheet are often convenient to write in GAS.

GAS
Good ForSpreadsheet-centric processing
CharacteristicsDirectly embedded in spreadsheet
App-side API
Good ForApp-centric processing
CharacteristicsOperates from servers like Vercel
Zapier etc.
Good ForNo-code integration
CharacteristicsEasy setup-only integration

For example, "send email when new row is added to spreadsheet" is simpler to complete with GAS.

Collaboration Workflow with Claude Code

Here's the method I actually use:

GAS Development Flow
Tell Claude Code What You Want

Consult: "I want to do this processing in a spreadsheet"

Generate GAS Code

Have it write GAS code to an appropriate file

Review Code

Check contents, request modifications if needed

Execute in Spreadsheet

Copy to GAS editor and execute

Report Problems

Tell Claude Code about errors for improvement

Step 1: Tell What You Want

First, tell Claude Code what you want to achieve.

When a new row is added to the "Sales" sheet in the spreadsheet,
I want to notify that content to Slack.
I want to implement this with GAS - can you write the code?

Step 2: Generate GAS Code

Claude Code generates the code. Instructing "write it to an appropriate file" saves it as a file in your project.

Please write it to gas-scripts/slack-notification.gs

This way, modification history is preserved and you can manage it with other GAS code.

Step 3: Review Code

Check the generated code. Ask questions about unclear points.

What does "onEdit" in this code do?

Once understood, proceed to the next step.

Step 4: Execute in Spreadsheet

  1. Open Google Spreadsheet
  2. Select "Extensions" → "Apps Script"
  3. Copy & paste code into GAS editor
  4. Save and execute (set up triggers as needed)

Step 5: Report Problems

If errors occur or things don't work as expected, tell Claude Code.

This error appeared:
"TypeError: Cannot read property 'getRange' of null"

Can you fix it?

Claude Code investigates both app-side design and GAS, suggesting fixes that maintain consistency between both. This is extremely useful.

Practical Use Cases

Example 1: Managing Form Submission Data

When managing data submitted from website forms in a spreadsheet:

  • App-side (Claude Code): API to write data to spreadsheet on form submission
  • GAS-side: Email notification to person in charge when new data is added

Example 2: Displaying Spreadsheet Data on Site

When displaying spreadsheet-managed data on a site:

  • GAS-side: Web app that publishes spreadsheet data in JSON format
  • App-side (Claude Code): Code to fetch and display that JSON

Example 3: Auto-Generate Periodic Reports

When generating sales reports and sending by email every Monday:

  • GAS-side: Aggregate spreadsheet data and send email (scheduled with triggers)
  • App-side: Write source data for reports to spreadsheet

Notes and Tips

Authentication/Permission Settings

When running GAS for the first time, Google account authentication is required. "This app is not verified" may appear, but for scripts you created yourself, proceed via "Advanced" → "Go to ○○ (unsafe)."

Checking Execution Logs

From "Executions" menu in GAS editor, you can check execution logs. This makes it easier to understand causes when errors occur.

Trigger Settings

Auto-execution like "when new row added" or "every day at 9am" is set from "Triggers" in GAS editor.

Security Considerations

Store confidential information like API keys or passwords using GAS Properties Service. Don't write them directly in code.

Summary

  • Spreadsheet-centric processing is convenient with GAS
  • Have Claude Code generate code and save to file
  • Review then execute in spreadsheet
  • Report problems to Claude Code for improvement
  • Investigating both app-side and GAS is convenient

Spreadsheets are familiar tools for many people. Combined with GAS, they can be used for everything from simple automation to full-scale system integration.

Related Topics