Skip to content

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

Open
codBang wants to merge 1 commit intosteipete:mainfrom
codBang:feat/sheets-conditional-banding-chart
Open

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

Conversation

@codBang
Copy link

@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

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.

1 participant