Skip to content

feat(sheets): add conditional-format, banding, and chart list commands#378

Closed
codBang wants to merge 1 commit intoopenclaw:mainfrom
codBang:feat/sheets-conditional-banding-chart
Closed

feat(sheets): add conditional-format, banding, and chart list commands#378
codBang wants to merge 1 commit intoopenclaw:mainfrom
codBang:feat/sheets-conditional-banding-chart

Conversation

@codBang
Copy link
Copy Markdown

@codBang codBang commented Feb 27, 2026

Summary

Adds first-class Sheets advanced formatting command groups to gog:

  • gog sheets conditional-format (add, list, clear)
  • gog sheets banding (set, clear)
  • gog sheets chart list

This closes a common automation gap where users need rule-based styling (conditional formats + alternating colors) instead of one-off manual coloring.

Why

Current gog sheets supports values/metadata/basic format, but lacks wrappers for advanced spreadsheets.batchUpdate operations. In real workflows this blocks:

  • Tier/status color rules that auto-apply to new rows
  • Alternating row banding for readability
  • Scriptable chart inventory for dashboard automation

What changed

  • Extended SheetsCmd registry in internal/cmd/sheets.go
    • added conditional-format, banding, chart
  • Added internal/cmd/sheets_advanced.go implementing:
    • SheetsConditionalFormatAddCmd
    • SheetsConditionalFormatListCmd
    • SheetsConditionalFormatClearCmd
    • SheetsBandingSetCmd
    • SheetsBandingClearCmd
    • SheetsChartListCmd
  • Added dry-run support for new mutating commands (--dry-run --json)

Validation

Local checks run:

  • go build -o ./bin/gog ./cmd/gog
  • go test ./internal/cmd -run 'Sheets|sheet'
  • CLI surface smoke checks ✅
    • ./bin/gog sheets --help
    • ./bin/gog sheets conditional-format --help
    • ./bin/gog sheets banding --help
    • ./bin/gog sheets chart --help

Dry-run behavior checks ✅

  • ./bin/gog sheets conditional-format add ... --dry-run --json --no-input
  • ./bin/gog sheets banding set ... --dry-run --json --no-input

Notes

  • This PR intentionally scopes chart support to list first (inventory/inspection).
  • chart create/update can be added incrementally in a follow-up PR once spec defaults are finalized.

Example usage

# Add A-tier highlight rule
gog sheets conditional-format add <sheetId> \
  --range 'Pipeline!A2:H999' \
  --type text-eq \
  --expr A \
  --style-json '{"backgroundColor":{"red":1,"green":0.8588,"blue":0.4275}}'

# List rules
gog sheets conditional-format list <sheetId> --json

# Remove all rules from a sheet
gog sheets conditional-format clear <sheetId> --sheet Pipeline --all

# Apply alternating banding
gog sheets banding set <sheetId> --range 'Pipeline!A1:H999'

# List embedded charts
gog sheets chart list <sheetId> --json

@steipete
Copy link
Copy Markdown
Collaborator

steipete commented Mar 8, 2026

Deep overlap with #434 on sheets chart: both register the chart subcommand, both implement chart list, both touch internal/cmd/sheets.go, and both would collide on the chart command surface. The chart part does not coexist cleanly. Best dedupe path from my review: let #434 own charts, and rebase this PR to keep only conditional-format + banding.

@steipete
Copy link
Copy Markdown
Collaborator

steipete commented May 5, 2026

Thanks @codBang. I landed the current-main version of this in #551 / b836495.

What landed:

  • gog sheets conditional-format (list, add, clear)
  • gog sheets banding (list, set, clear)
  • force-guarded destructive clears
  • README, docs/sheets-formatting.md, generated command pages, changelog credit
  • regression tests plus live Google smoke against a disposable spreadsheet

I did not re-land the chart-list slice from this branch because main already has the fuller gog sheets chart command set from #434: list/get/create/update/delete. Closing this PR as superseded by the landed replacement. Thanks again for the useful starting point.

@steipete steipete closed this May 5, 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