Skip to content

Feat sheets insert text #233

Open
raybell-md wants to merge 4 commits intogemini-cli-extensions:mainfrom
raybell-md:feat-sheets-insert-text-13125415055850654377
Open

Feat sheets insert text #233
raybell-md wants to merge 4 commits intogemini-cli-extensions:mainfrom
raybell-md:feat-sheets-insert-text-13125415055850654377

Conversation

@raybell-md
Copy link
Contributor

@raybell-md raybell-md commented Feb 22, 2026

Closes #232

This is a jules PR (see raybell-md#8)

I can strip out the changes to logger if desired

google-labs-jules bot and others added 3 commits February 22, 2026 23:09
- Implement `insertText` method in `SheetsService` to write data to Google Sheets.
- Update OAuth scopes in `index.ts` to include full spreadsheet write access.
- Register `sheets.insertText` tool in the MCP server.
- Add unit tests for the new functionality and error handling.
- Follow established project patterns for error reporting and URL-to-ID extraction.

I implemented the requested `sheets.insertText` feature which allows users to write data to a specific cell or range in Google Sheets. The implementation uses the Sheets API v4 `spreadsheets.values.update` method with the `USER_ENTERED` option. I also updated the extension's scopes and added comprehensive tests. While I attempted to run the tests, a local environment issue with the Jest binary path prevented execution, but the implementation aligns with existing service structures.

Co-authored-by: raybell-md <196701227+raybell-md@users.noreply.github.com>
- Implement `insertText` method in `SheetsService` to write data to Google Sheets.
- Update OAuth scopes in `index.ts` to include full spreadsheet write access.
- Register `sheets.insertText` tool in the MCP server.
- Add unit tests for the new functionality and error handling.
- Follow established project patterns for error reporting and URL-to-ID extraction.

Re-submitting changes as they were lost in the previous attempt. implementation uses the Sheets API v4 `spreadsheets.values.update` method with the `USER_ENTERED` option. I also updated the extension's scopes and added comprehensive tests.

Co-authored-by: raybell-md <196701227+raybell-md@users.noreply.github.com>
- Implement `insertText` method in `SheetsService` to write data to Google Sheets using `spreadsheets.values.update`.
- Update OAuth scopes in `index.ts` to include `https://www.googleapis.com/auth/spreadsheets`.
- Register `sheets.insertText` tool in the MCP server.
- Add unit tests for the new functionality and error handling in `SheetsService.test.ts`.
- Fix CI failure in `logger.test.ts` by increasing timeouts for module-level initialization tests and using consistent module names for mocking.

The `sheets.insertText` feature allows writing data to specific ranges in Google Sheets.
I also addressed a timeout failure in `logger.test.ts` discovered during CI, which was likely due to a race condition in the module-level async initialization test on slow runners.

Co-authored-by: raybell-md <196701227+raybell-md@users.noreply.github.com>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @raybell-md, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces the capability to programmatically insert text into Google Sheets. It achieves this by adding a new insertText service method, registering it as an available tool, and updating the necessary API permissions. The changes enable more dynamic interaction with Google Sheets, allowing for data manipulation beyond just reading.

Highlights

  • New Sheets Text Insertion Feature: A new sheets.insertText tool has been implemented, allowing users to insert text or values into specific cells or ranges within Google Sheets spreadsheets.
  • Google Sheets API Scope Update: The Google Sheets API scope has been broadened from readonly to full spreadsheets access, enabling write operations necessary for the new text insertion functionality.
  • Comprehensive Testing for New Feature: Unit tests have been added for the insertText method, covering both successful text insertion and graceful error handling scenarios.
  • Logger Test Stability Improvements: Minor adjustments were made to logger module initialization tests, including updating fs/promises import paths and increasing test timeouts for enhanced stability.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • workspace-server/src/tests/services/SheetsService.test.ts
    • Added mock for sheets.values.update method to support testing of write operations.
    • Implemented unit tests for the new insertText function, covering successful text insertion and error handling.
  • workspace-server/src/tests/utils/logger.test.ts
    • Updated fs/promises import to node:fs/promises for consistency and clarity.
    • Increased setTimeout duration and test timeouts in logger tests for improved stability, especially in CI environments.
  • workspace-server/src/index.ts
    • Elevated Google Sheets API scope from read-only (spreadsheets.readonly) to full read/write access (spreadsheets).
    • Registered a new sheets.insertText tool, defining its description and input schema for spreadsheet text insertion.
  • workspace-server/src/services/SheetsService.ts
    • Implemented the insertText asynchronous method to handle text insertion into Google Sheets using the Google API client.
    • Included logging for insertText operations and robust error handling for API calls to provide better feedback and debugging.
Activity
  • No specific activity (comments, reviews, or progress updates) has been recorded for this pull request since its creation.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request successfully adds a new feature to insert text into Google Sheets. The implementation includes the service logic in SheetsService, registration of the new sheets.insertText tool, and comprehensive unit tests. The required API scope has also been correctly updated. Additionally, the PR includes improvements to test stability for the logger utility and modernizes module imports by using the node: prefix. I've added a couple of suggestions to further improve test reliability by avoiding setTimeout in favor of awaiting an initialization promise. Overall, the changes are well-structured and a great addition to the project.

@raybell-md
Copy link
Contributor Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the sheets.insertText tool, allowing users to insert text or values into specific cells or ranges within a Google Sheets spreadsheet. The implementation correctly updates the OAuth scopes to allow write access (https://www.googleapis.com/auth/spreadsheets), registers the new tool with a clear input schema in the main entry point, and adds the corresponding logic in SheetsService. The service method uses USER_ENTERED as the value input option, which is a sensible default for handling various data types and formulas. Comprehensive unit tests have been added to cover both success and error scenarios, ensuring the robustness of the new functionality. The code follows existing patterns and conventions in the repository.

@raybell-md
Copy link
Contributor Author

To test:

  1. Create a google sheet
  2. Prompt

I have csv data like

a,b
1,2

Can you write that to {{ SHEET URL }}

Works albeit one cell at at time. Which is fine for this PR. We can add other function e.g. batch write in other PR's

Screenshot 2026-02-25 164523 Screenshot 2026-02-25 164622

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.

feature request: sheets.insertText

1 participant