Skip to content

readSpreadsheet ignores valueRenderOption parameter #65

@a-pedraza

Description

@a-pedraza

Bug Description

The readSpreadsheet tool accepts a valueRenderOption parameter (with options FORMATTED_VALUE, UNFORMATTED_VALUE, FORMULA), but the parameter is never passed through to the Google Sheets API call. This means requesting FORMULA still returns computed/formatted values instead of the actual formula strings.

Steps to Reproduce

  1. Create a spreadsheet with a formula in a cell (e.g., =SUM(A1:A5))
  2. Call readSpreadsheet with valueRenderOption: "FORMULA"
  3. Observe that the result contains the computed value (e.g., "15") instead of the formula string (e.g., "=SUM(A1:A5)")

Root Cause

Two places where the parameter is dropped:

  1. src/tools/sheets/readSpreadsheet.ts (line 30) — args.valueRenderOption is not passed to the helper:

    const response = await SheetsHelpers.readRange(sheets, args.spreadsheetId, args.range);
  2. src/googleSheetsApiHelpers.tsreadRange() doesn't accept or forward the parameter to sheets.spreadsheets.values.get().

Expected Behavior

When valueRenderOption: "FORMULA" is passed, the API should return formula strings (e.g., "=SUM(A1:A5)") instead of computed values.

Fix

  • Add valueRenderOption parameter to readRange() in the helpers file
  • Pass args.valueRenderOption in the tool's execute call
  • Forward it to sheets.spreadsheets.values.get({ spreadsheetId, range, valueRenderOption })

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions