Add autoResizeColumns and setColumnWidths tools#80
Merged
a-bonus merged 1 commit intoa-bonus:mainfrom Mar 14, 2026
Merged
Conversation
Adds two new Google Sheets tools:
- autoResizeColumns: auto-fits columns to their content using the
Sheets API autoResizeDimensions batchUpdate. Accepts an optional
column range (e.g. "A:S") to limit which columns are resized.
- setColumnWidths: sets explicit pixel widths for one or more columns.
Accepts an array of { column, width } specs; each column can be a
single letter ("A") or range ("B:D").
The setColumnWidths helper logic lives in googleSheetsApiHelpers.ts
and is shared with the tool implementation.
Owner
|
Thanks for your contribution  |
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.
Summary
autoResizeColumns— auto-fits columns to their content using the Sheets APIautoResizeDimensionsbatchUpdate. Accepts an optional column range in A1 notation (e.g."A:S") to limit which columns are resized; defaults to all columns.setColumnWidths— sets explicit pixel widths for one or more columns in a single call. Accepts an array of{ column, width }specs; each column can be a single letter ("A") or a contiguous range ("B:D").Helper logic for
setColumnWidthslives ingoogleSheetsApiHelpers.tsalongside the existing sheet helpers.Both tools follow existing conventions: camelCase verb-first names, Zod parameters with
.describe()on every field,UserErrorfor user-facing errors, plain string return values consistent with other write-operation tools (e.g.formatCells,freezeRowsAndColumns).Test plan
autoResizeColumnswith nocolumnsarg resizes all columnsautoResizeColumnswithcolumns: "A:C"resizes only columns A through CsetColumnWidthswith a single column spec sets the correct pixel widthsetColumnWidthswith multiple specs applies all widths in one batchUpdateUserErroron invalid spreadsheet ID or missing permissionsnpm run format:checkpassesnpm run buildpasses with no TypeScript errors🤖 Generated with Claude Code