Skip to content

Conversation

von-development
Copy link
Contributor

Description

Add comprehensive Google Sheets write operations to the community package, providing tools for creating and modifying spreadsheet data with OAuth2 authentication. Also includes bug fixes and improvements to existing read tools for consistency and correctness.

Relevant issues

N/A

Type

🆕 New Feature
🐛 Bug Fix
✅ Test

Changes

New: Google Sheets write operations

New Tools:

  • SheetsCreateSpreadsheetTool — create new spreadsheets with optional initial data
  • SheetsUpdateValuesTool — update cell values in existing ranges
  • SheetsAppendValuesTool — append rows to sheets with overflow handling
  • SheetsClearValuesTool — clear data from specified ranges
  • SheetsBatchUpdateValuesTool — update multiple ranges in a single API call

Features:

  • OAuth2 authentication required
  • Support for mixed data types (strings, numbers, booleans, formulas)
  • ValueInputOption and InsertDataOption enums
  • Consistent return format with success and spreadsheet_id fields
  • Rich docstrings with examples for LLM agents

Bug fixes: Read tool improvements

  • Fixed multi-grid data processing to prevent silent data loss
  • Fixed boolean value extraction in _safe_get_cell_value
  • Fixed SheetsFilteredReadDataTool schema to match Google Sheets API
  • Enhanced A1 notation validation (single cells, whole rows/columns, sheet-qualified ranges, named ranges)
  • Fixed domain-wide delegation scope downgrade
  • Standardized return types to dictionaries with success field

Code quality

  • Moved _convert_to_dict_list to base class
  • Deleted unused urls.py
  • Fixed Python 3.9 compatibility in toolkit.py
  • Updated toolkit and package exports

Testing

All quality checks passed:

  • ruff and mypy clean
  • 11/11 unit tests passing
  • Integration tests verified with OAuth2
  • Python 3.9-3.13 compatible

Test coverage includes:

  • Creating, updating, appending, clearing, and batch-updating spreadsheets
  • Mixed data types and OAuth2 enforcement
  • Dictionary returns, multi-grid processing, and A1 validation

Note

Authentication:

  • Write operations require OAuth2 (api_resource)
  • API key remains read-only

Follow-up PRs:
Potential future enhancements:

  • Formatting operations (fonts, colors, borders)
  • Filter Views management
  • Advanced features (charts, pivot tables, conditional formatting)

Checklist

  • PR Title follows convention: "feat(community): Add Google Sheets write operations and improve read tools"
  • Added tests
  • All linting and formatting checks pass
  • Type checking passes
  • Optional dependencies properly handled
  • Changes are backwards compatible

- Add SheetsCreateSpreadsheetTool for creating spreadsheets
- Add SheetsUpdateValuesTool for updating cell values
- Add SheetsAppendValuesTool for appending rows
- Add SheetsClearValuesTool for clearing ranges
- Add SheetsBatchUpdateValuesTool for batch operations
- Export all new tools from sheets and community modules
- Support List[List[Any]] for mixed data types
- Return dicts instead of JSON strings for all read tools
- Add success and spreadsheet_id fields to all returns
- Fix boolean handling in cell value extraction
- Fix multi-grid data processing
- Fix SheetsFilteredReadDataTool DataFilter schema
- Fix domain-wide delegation scope bug
- Improve A1 notation validation (support all range formats)
- Add write operation enums (ValueInputOption, InsertDataOption)
- Move _convert_to_dict_list to base class
- Update toolkit to include write tools with OAuth2
- Remove unused urls.py file
…n tests

- Add unit tests for all 5 new write tools
- Add unit test for SheetsFilteredReadDataTool
- Update integration tests to handle dict returns instead of JSON strings
- Update toolkit tests to verify write tools require OAuth2
- Add missing newlines at end of files
- Fix blank line spacing in docstrings
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