View as Markdown
Google Sheets icon

Google Sheets ACTION

Format Worksheet

Change worksheet-level layout in Google Sheets: freeze header rows or columns, auto-resize columns to fit their contents, set explicit column widths or row heights, hide gridlines, color the sheet tab, or rename the worksheet. Use this when a user asks to freeze/lock a header row, make columns wide enough to read, widen or narrow a column, or tidy up a sheet they just uploaded or imported. autoResizeColumns is usually what fixes an imported sheet where columns are too narrow and numbers show as ####. To style the cells themselves (bold, colors, number formats), use Format Cells. Use Get Spreadsheet Info to discover worksheet names. Example: to lock the header row and fit every column to its content on a freshly imported sheet, call with sheetName="Q3 Revenue", freezeRows=1, autoResizeColumns="ALL" → returns the layout changes applied plus a link to the worksheet. See the documentation
  • Action
  • Writes data
  • OAuth
  • SDK
  • MCP

IMPLEMENTATION

Call this tool

Connect a user's Google Sheets account once, then configure and run Format Worksheet from your backend or agent.

import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "google_sheets-format-worksheet",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    google_sheets: { authProvisionId: "apn_xxxxxxx" },
    spreadsheetId: "Spreadsheet ID",
    sheetName: "Worksheet Name",
  },
})

console.log(result)

SCHEMA

Inputs

Pipedream supplies the connected account. Your application provides the operation-specific values below. Dynamic inputs are resolved against that user's account.

Format Worksheet inputs
Property Type Description
spreadsheetId Spreadsheet ID string
The spreadsheet ID from the Google Sheets URL. Use List Spreadsheets to find it by name.
Required
sheetName Worksheet Name string
The worksheet (tab) name. Use Get Spreadsheet Info to discover worksheet names.
Required
freezeRows Freeze Rows integer
Number of rows to freeze at the top so they stay visible while scrolling. Use 1 to freeze a single header row, 0 to unfreeze.
Optional
freezeColumns Freeze Columns integer
Number of columns to freeze at the left. Use 1 to keep a label column visible while scrolling right, 0 to unfreeze.
Optional
autoResizeColumns Auto-Resize Columns string
Resize columns to fit their widest value. Pass ALL for every column, or a column reference like A:F or C to limit it. This is the fastest fix for an imported sheet whose columns are too narrow.
Optional
columnWidths Column Widths string
JSON object mapping column references to widths in pixels, e.g. {"A": 240, "C:E": 120}. Use this instead of autoResizeColumns when a specific width is wanted.
Optional
rowHeights Row Heights string
JSON object mapping row references to heights in pixels, e.g. {"1": 40, "2:10": 24}.
Optional
hideGridlines Hide Gridlines boolean
Set true to hide the worksheet's gridlines (a common finishing touch on a report), false to show them.
Optional
tabColor Tab Color string
Color of the worksheet tab, as a hex code (#1155cc) or a common color name (dark blue, green).
Optional
newSheetName New Worksheet Name string
Rename the worksheet to this. Leave empty to keep the current name.
Optional

REFERENCE

Tool details

Behavior hints are published with the component in the Pipedream registry and surface as MCP tool annotations, so an agent can reason about a tool before it calls it.

Registry key
google_sheets-format-worksheet
Version
0.0.1
App
Google Sheets
Authentication
OAuth
Read-only
No
Destructive
No
Open world
Yes