Skip to content

feat(sheets): add chart subcommand (create, list, get, update, delete)#434

Closed
andybergon wants to merge 1 commit intosteipete:mainfrom
andybergon:feat/sheets-chart
Closed

feat(sheets): add chart subcommand (create, list, get, update, delete)#434
andybergon wants to merge 1 commit intosteipete:mainfrom
andybergon:feat/sheets-chart

Conversation

@andybergon
Copy link
Copy Markdown
Contributor

Summary

  • Adds sheets chart with list/get/create/update/delete subcommands
  • Charts managed via --spec-json passthrough of EmbeddedChartSpec JSON, keeping scope small while covering all chart types
  • create supports --sheet, --anchor, --width, --height for positioning
  • delete requires --force or interactive confirmation

Examples

# List all charts
gog sheets chart list <spreadsheetId>

# Get full chart definition (spec + position)
gog sheets chart get <spreadsheetId> <chartId> --json

# Backup a chart, delete it, and recreate it
gog sheets chart get <spreadsheetId> 563157883 --json > chart.json
gog sheets chart delete <spreadsheetId> 563157883 --force
gog sheets chart create <spreadsheetId> --spec-json @chart.json

# Create with explicit positioning
gog sheets chart create <spreadsheetId> --spec-json @chart.json --sheet Sheet1 --anchor E10 --width 800 --height 400

# Update a chart's spec (e.g. change title and type)
gog sheets chart update <spreadsheetId> <chartId> --spec-json '{"title":"Revenue Q1","basicChart":{"chartType":"PIE"}}'

Test plan

  • 15 unit tests covering all commands, JSON/text output, anchor positioning, validation, dry-run, and destructive confirmation
  • Manually tested against a real spreadsheet: list, get, delete, create, update all working end-to-end

Closes #432

Adds `sheets chart` with get/list/create/update/delete operations.
Charts are managed via --spec-json passthrough of EmbeddedChartSpec JSON,
keeping scope small while covering all chart types. Create supports
--sheet, --anchor, --width, --height for positioning. Delete requires
--force or interactive confirmation.

Closes steipete#432

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@steipete
Copy link
Copy Markdown
Owner

Landed in acb40a8. Thanks @andybergon!

Notes:

  • Kept the chart command set and tightened it while landing.
  • Accepts both ChartSpec and EmbeddedChart JSON for create/update.
  • Remaps zero/omitted chart source range sheet IDs to the selected/current tab so specs work against newly-created spreadsheets.
  • Added regression coverage and README/CHANGELOG entries.

Verified:

  • make ci
  • live Sheets create/list/get/update/delete chart round-trip with clawdbot account
  • live empty chart list JSON returns []

@steipete
Copy link
Copy Markdown
Owner

Landed on main in acb40a8. Closing this PR; thanks again @andybergon.

@steipete steipete closed this Apr 20, 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.

feat: add sheets chart subcommand (create, list, update, delete)

2 participants