Skip to content

feat(sheets): formatting commands#320

Merged
steipete merged 2 commits intoopenclaw:mainfrom
Shehryar:feat/sheets-formatting-commands
Mar 9, 2026
Merged

feat(sheets): formatting commands#320
steipete merged 2 commits intoopenclaw:mainfrom
Shehryar:feat/sheets-formatting-commands

Conversation

@Shehryar
Copy link
Copy Markdown

Summary

Adds 7 new sheets subcommands covering formatting and layout
operations:

  • merge / unmerge — merge and unmerge cell ranges (supports
    MERGE_ALL, MERGE_COLUMNS, MERGE_ROWS)
  • number-format — apply number format types (NUMBER,
    CURRENCY, PERCENT, DATE, TIME, DATE_TIME, SCIENTIFIC, TEXT) with
    optional custom patterns
  • freeze — freeze rows and/or columns, with --sheet
    selector defaulting to the first sheet
  • resize-columns / resize-rows — set fixed pixel size or
    auto-fit to content (both support --auto)
  • conditional-format — add boolean conditional formatting
    rules (NUMBER_GREATER, TEXT_CONTAINS, BLANK, etc.) with
    --bg-color, --text-color, and --bold styling

Also includes a fix for the build-breaking type grouping bug in
contacts_crud.go (duplicates #287, needed to compile).

Details

  • All commands use BatchUpdate with the appropriate request
    types (MergeCells, RepeatCell, UpdateSheetProperties,
    UpdateDimensionProperties, AutoResizeDimensions,
    AddConditionalFormatRule)
  • Follows existing patterns from sheets_format.go: input
    validation, normalizeGoogleID, cleanRange, parseSheetRange
  • gridRangeFromMap for range resolution, dryRunExit, JSON
    output via outfmt
  • resolveSheetIDByNameOrFirst is a new shared helper used by
    freeze and resize commands for sheet resolution without
    requiring a full A1 range
  • parseSheetsColor supports both #RRGGBB and r,g,b (0-255
    integer) inputs
  • parseColumnsSpan / parseRowsSpan handle dimension-only A1
    ranges (e.g. Sheet1!A:C, Sheet1!1:10)
  • Freeze uses ForceSendFields to ensure zero values (unfreeze)
    are serialized correctly

Test plan

  • make test passes (5 new test files with httptest mock
    servers)
  • make fmt clean (gofumpt + goimports)
  • make lint clean for all new files (remaining warnings
    are pre-existing in contacts/sheets_insert)
  • Manual testing against a real spreadsheet (all 7 commands
    verified)

New files

  • sheets_merge.go — merge/unmerge commands
  • sheets_number_format.go — number-format command
  • sheets_freeze.go — freeze command, shared sheet resolver helper
  • sheets_resize.go — resize-columns/resize-rows, dimension span parsing
  • sheets_conditional_format.go — conditional-format, color parsing, rule validation
  • Five matching test files

@Shehryar Shehryar changed the title Feat/sheets formatting commands feat(sheets): formatting commands Feb 20, 2026
@steipete steipete force-pushed the feat/sheets-formatting-commands branch from 0d87afa to b016280 Compare March 9, 2026 03:24
@steipete steipete merged commit 004b68c into openclaw:main Mar 9, 2026
1 check passed
@steipete
Copy link
Copy Markdown
Collaborator

steipete commented Mar 9, 2026

Landed via reviewed rebase onto main.

  • Gate: go test ./internal/cmd -run 'TestSheets(MergeCmds|NumberFormatCmd|FreezeCmd|ResizeCmds|Format|ReadFormat)' -count=1, make lint, make test, make ci\n- Land commit: b016280\n- Merge commit: 004b68c\n\nNarrowed the PR to the non-overlapping fit on current main: landed merge/unmerge, number-format, freeze, and resize; skipped conditional-format (#378) and the unrelated contacts churn. Also fixed zero-valued sheet-id/start-index force-send cases for first-sheet operations.\n\nThanks @Shehryar!

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.

2 participants