Skip to content

feat(sheets): add insert subcommand for rows and columns#203

Open
andybergon wants to merge 1 commit intosteipete:mainfrom
andybergon:feat/sheets-insert-rows
Open

feat(sheets): add insert subcommand for rows and columns#203
andybergon wants to merge 1 commit intosteipete:mainfrom
andybergon:feat/sheets-insert-rows

Conversation

@andybergon
Copy link

@andybergon andybergon commented Feb 8, 2026

Closes #202

Summary

Adds gog sheets insert <spreadsheetId> <sheet> <rows|cols> <start> [--count N] [--after] to insert empty rows or columns at a specific position in a sheet.

Uses the Sheets API InsertDimensionRequest via batchUpdate, following the same pattern as format and copy-validation-from.

Usage

# Insert 3 empty rows before row 2
gog sheets insert <id> "Sheet1" rows 2 --count 3

# Insert 1 column after column 3
gog sheets insert <id> "Sheet1" cols 3 --after

New flags

Flag Description Default
--count Number of rows/columns to insert 1
--after Insert after the specified position instead of before false

Testing

  • Unit tests with httptest mock server covering rows before/after, cols before/after, and invalid dimension
  • make ci passes (fmt, lint, all tests)

@andybergon andybergon changed the title feat(sheets): add insert-rows subcommand feat(sheets): add insert-rows and insert-cols subcommands Feb 8, 2026
@andybergon andybergon changed the title feat(sheets): add insert-rows and insert-cols subcommands feat(sheets): add insert subcommand for rows and columns Feb 8, 2026
@andybergon andybergon force-pushed the feat/sheets-insert-rows branch from bd89094 to ab5b5ed Compare February 8, 2026 05:20
Adds `gog sheets insert <id> <sheet> <rows|cols> <start>` to insert
empty rows or columns at a specific position using the Sheets API
InsertDimensionRequest via batchUpdate.

Supports --count for multiple rows/columns and --after to insert after
the specified position instead of before.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@andybergon andybergon force-pushed the feat/sheets-insert-rows branch from ab5b5ed to 3703c20 Compare February 8, 2026 05:20
@andybergon
Copy link
Author

This PR is ready for review.

Note: I squashed and force-pushed — the initial version only had insert-rows, but since the Sheets API InsertDimensionRequest supports both rows and columns via the Dimension field, I consolidated it into a single insert subcommand that handles both with a rows/cols argument.

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.

Feature(sheets): Insert rows/columns at a specific position

1 participant