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)curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
-H "Content-Type: application/json" \
-H "X-PD-Environment: production" \
-H "Authorization: Bearer {access_token}" \
-d '{
"external_user_id": "{external_user_id}",
"id": "google_sheets-format-worksheet",
"configured_props": {
"google_sheets": { "authProvisionId": "apn_xxxxxxx" },
"spreadsheetId": "Spreadsheet ID",
"sheetName": "Worksheet Name"
}
}'// accessToken: mint a short-lived token with the Connect SDK — see the MCP guide
const transport = new StreamableHTTPClientTransport(
new URL("https://remote.mcp.pipedream.net/v3"),
{
requestInit: {
headers: {
Authorization: `Bearer ${accessToken}`,
"x-pd-project-id": "{project_id}",
"x-pd-environment": "production",
"x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
"x-pd-app-slug": "google_sheets",
},
},
},
)
const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)
const { tools } = await mcp.listTools()
// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
name: "google_sheets-format-worksheet",
arguments: {
spreadsheetId: "Spreadsheet ID",
sheetName: "Worksheet Name",
},
})SCHEMA
Inputs
Pipedream supplies the connected account. Your application provides the operation-specific values below. Dynamic inputs are resolved against that user's account.
| 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
- Source
- View on GitHub ↗