feat(sheets): add tab management commands (add-tab, rename-tab, delete-tab)#309
Closed
JulienMalige wants to merge 2 commits intoopenclaw:mainfrom
Closed
feat(sheets): add tab management commands (add-tab, rename-tab, delete-tab)#309JulienMalige wants to merge 2 commits intoopenclaw:mainfrom
JulienMalige wants to merge 2 commits intoopenclaw:mainfrom
Conversation
…e-tab) Add three new subcommands for managing tabs/sheets within a spreadsheet: - `gog sheets add-tab <spreadsheetId> <tabName>` — creates a new tab - `gog sheets rename-tab <spreadsheetId> <oldName> <newName>` — renames a tab - `gog sheets delete-tab <spreadsheetId> <tabName>` — deletes a tab (requires --force or confirmation) Uses the Sheets API batchUpdate with AddSheet, UpdateSheetProperties, and DeleteSheet requests, following the same patterns as the existing insert and format commands. Includes unit tests with httptest mock server covering all three commands plus error cases for unknown tab names.
Author
|
Closes #310 |
Author
|
Note: The build has pre-existing compile errors in All 3 new commands tested successfully against a live spreadsheet:
|
|
this is very nice indeed! thanks for this pr |
steipete
added a commit
that referenced
this pull request
Mar 8, 2026
Collaborator
|
Landed directly on main from a current-main rebase.
Thanks @JulienMalige! |
Collaborator
klodr
pushed a commit
to klodr/gogcli
that referenced
this pull request
Apr 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds three new subcommands for managing tabs/sheets within a spreadsheet, using the Sheets API
batchUpdateendpoint:gog sheets add-tab <spreadsheetId> <tabName>— Create a new tab/sheetgog sheets rename-tab <spreadsheetId> <oldName> <newName>— Rename an existing tabgog sheets delete-tab <spreadsheetId> <tabName>— Delete a tab (requires--forceor interactive confirmation)Motivation
The existing
sheetscommands support reading/writing cell data (get,update,append,clear), formatting (format), inserting rows/columns (insert), and creating spreadsheets (create), but there is no way to manage the tabs themselves within an existing spreadsheet. This is a common need when programmatically building multi-tab spreadsheets.Implementation
Uses
BatchUpdateSpreadsheetRequestwith:AddSheetRequestforadd-tabUpdateSheetPropertiesRequest(fields:title) forrename-tabDeleteSheetRequestfordelete-tabFollows the same patterns as
sheets insert(PR #203) — usesfetchSheetIDMapfor tab name → sheet ID resolution,confirmDestructivefor delete safety, and supports--jsonoutput and--dry-run.Usage
Testing
add-tab— verifiesAddSheetrequest with correct titlerename-tab— verifiesUpdateSheetPropertieswith correct sheet ID, title, and fields maskdelete-tab --force— verifiesDeleteSheetwith correct sheet IDrename-tabunknown tab — error handlingdelete-tabunknown tab — error handlingcontacts_crud.gohas pre-existing type errors onmainthat prevent fullgo build ./...; this PR does not touch that fileNew files
internal/cmd/sheets_tab.gointernal/cmd/sheets_tab_test.gointernal/cmd/sheets.go