Add chart functionality to gspread#1575
Open
darkfiberiru wants to merge 1 commit intoburnash:masterfrom
Open
Conversation
This commit adds comprehensive chart support to gspread, enabling users to create, update, delete, and list charts in Google Sheets. New features: - Worksheet.add_chart() - Create charts with customizable properties - Worksheet.update_chart() - Modify existing chart specifications - Worksheet.delete_chart() - Remove charts by ID - Worksheet.list_charts() - List all charts in a worksheet New enums in utils: - ChartType - Chart types (column, line, area, bar, scatter, combo, stepped_area) - ChartLegendPosition - Legend positions (bottom, left, right, top, no_legend) - ChartAxisPosition - Axis positions (bottom_axis, left_axis, right_axis) Implementation details: - Uses Google Sheets API v4 batchUpdate endpoint - Supports multiple data series per chart - Handles both single-range (auto-generated domain) and multi-range (explicit domain) data - Includes input validation for data ranges and dimensions - Converts A1 notation to GridRange format - Properly handles enum to string conversion for API calls Documentation: - Added comprehensive user guide section with examples - Includes usage examples for all chart operations - Documents all chart types and configuration options Fixes applied during code review: - Fixed enum string conversion for ChartAxisPosition - Corrected data range logic for single vs multiple ranges - Added KeyError protection in list_charts() - Added input validation for empty ranges and invalid dimensions - Validated non-empty series before chart creation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Author
|
@burnash I understand if you not a fan of AI for personal reason or more complicated one but realizing gap in lack of ability to create graphs with gspread library I added them with help of claude-code from anthropic. So here it is. |
Author
|
I see this repo is in freeze due to lack of maintainer |
Collaborator
hi :] thanks for the suggestion. yes it is. please see #1570 |
darkfiberiru
pushed a commit
to darkfiberiru/gspread
that referenced
this pull request
Dec 1, 2025
Adds comprehensive charting capabilities to gspread with four new worksheet methods: - add_chart(): Create charts with customizable types, titles, and positions - update_chart(): Modify existing chart specifications - delete_chart(): Remove charts by ID - list_charts(): Retrieve all charts in a worksheet Includes three new enums for chart configuration: - ChartType: bar, line, area, column, scatter, combo, stepped_area - ChartLegendPosition: bottom, left, right, top, no_legend - ChartAxisPosition: bottom_axis, left_axis, right_axis Supports multiple data series, A1 notation conversion, and full chart customization through the Google Sheets API v4 batchUpdate endpoint. PR: burnash#1575
Contributor
|
@darkfiberiru Something is unclear about updating an existing chart. Let's say I have this chart data range currently defined:
How do I extend the data range, axis and series down to say line 575? I didn't see anything in Worksheet.update_chart() to update those. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This commit adds comprehensive chart support to gspread, enabling users to create, update, delete, and list charts in Google Sheets.
New features:
New enums in utils:
Implementation details:
Documentation:
Fixes applied during code review:
🤖 Generated with Claude Code