Skip to content

feat(sheets): add named ranges support#278

Merged
steipete merged 2 commits intoopenclaw:mainfrom
TheCrazyLex:dev/feat-sheets-named-ranges
Mar 8, 2026
Merged

feat(sheets): add named ranges support#278
steipete merged 2 commits intoopenclaw:mainfrom
TheCrazyLex:dev/feat-sheets-named-ranges

Conversation

@TheCrazyLex
Copy link
Copy Markdown
Contributor

Summary

Adds named range support for Google Sheets.

User-Facing Changes

  • New command group: gog sheets named-ranges (list/get/add/update/delete).
  • Accept named range names for GridRange-backed operations:
    • gog sheets format <spreadsheetId> <namedRange>
    • gog sheets update|append ... --copy-validation-from <namedRange>
  • Updated help text/docs to mention named ranges where applicable.

Implementation Notes

  • Adds a shared spreadsheet range catalog fetch (sheets + namedRanges) and a resolver that maps either A1-with-sheet or named range name/ID into a GridRange.
  • Extends A1 parsing for GridRange operations to support column/row/unbounded forms (e.g. Sheet1!A:C, Sheet1!2:10, Sheet1!B5:D).
  • Ensures sheetId is always sent for GridRanges even when it is 0 (first sheet), via ForceSendFields.

Docs

  • README examples updated.

Testing

  • go test ./...
  • Manual (live): verified named range CRUD + using named ranges with format and validation copy.

Copilot AI review requested due to automatic review settings February 16, 2026 02:33
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds named range support to the Sheets CLI, including CRUD commands for named ranges and allowing named range inputs where GridRange-backed operations are required.

Changes:

  • Introduces a shared spreadsheet “range catalog” fetch + resolver to map either Sheet!A1 or named range name/ID into a GridRange.
  • Adds gog sheets named-ranges command group (list/get/add/update/delete).
  • Extends A1 parsing to support column-only, row-only, and open-ended A1 forms for GridRange operations.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
internal/cmd/sheets_validation.go Switches validation-copy source range resolution to named-range-aware catalog; updates GridRange construction to force-send SheetId.
internal/cmd/sheets_update_validation_test.go Adds test coverage for --copy-validation-from using a named range.
internal/cmd/sheets_range_resolve.go New: fetches sheet+namedRanges catalog and resolves input to GridRange; resolves named ranges by name/ID.
internal/cmd/sheets_notes.go Updates help text to mention named ranges for notes range argument.
internal/cmd/sheets_named_ranges.go New: implements sheets named-ranges CRUD commands and output formatting.
internal/cmd/sheets_named_ranges_test.go New: tests add/update/delete named range commands via mocked Sheets API.
internal/cmd/sheets_format.go Allows format to accept named range inputs by resolving via catalog.
internal/cmd/sheets_format_test.go Adds test coverage for format using a named range.
internal/cmd/sheets_a1.go Extends A1 parsing to accept column ranges, row ranges, and open-ended forms.
internal/cmd/sheets_a1_test.go Adds tests for the new A1 parsing forms.
internal/cmd/sheets.go Registers named-ranges command group; updates help text to mention named ranges where applicable.
README.md Updates examples to show named range usage + new named-ranges commands.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/cmd/sheets_range_resolve.go Outdated
Comment thread internal/cmd/sheets_named_ranges.go Outdated
Comment thread internal/cmd/sheets_validation.go
Comment thread internal/cmd/sheets_range_resolve.go Outdated
@TheCrazyLex TheCrazyLex force-pushed the dev/feat-sheets-named-ranges branch from 3bbe80a to cea84d8 Compare February 16, 2026 02:59
@TheCrazyLex
Copy link
Copy Markdown
Contributor Author

@steipete Please review :)

TheCrazyLex and others added 2 commits March 8, 2026 02:18
Adds a new `sheets named-ranges` command group to list/get/add/update/delete
named ranges via Sheets batchUpdate.

Extends range handling so `sheets format` and data-validation copy can target
named ranges, improves A1 parsing for GridRange-backed operations, and includes
reviewed safety/regression updates for range resolution and SheetId force-send.
@steipete steipete force-pushed the dev/feat-sheets-named-ranges branch from cea84d8 to 3e5972e Compare March 8, 2026 02:21
@steipete steipete merged commit 3c696c9 into openclaw:main Mar 8, 2026
@steipete
Copy link
Copy Markdown
Collaborator

steipete commented Mar 8, 2026

Landed via temp rebase onto main.

Fixups in the land pass:

  • resolved rebase conflict with current Sheets subcommands
  • tightened named-range resolution to satisfy current lint rules
  • added changelog credit

Thanks @TheCrazyLex!

@TheCrazyLex TheCrazyLex deleted the dev/feat-sheets-named-ranges branch March 8, 2026 02:22
klodr pushed a commit to klodr/gogcli that referenced this pull request Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants