Skip to content
Agent Tools

captureRange

Render a range as a PNG image and return its raw bytes (Uint8Array).

Use this when the formatting itself is the information — fills, font colors, borders, merged cells, number formats — that the text-grid tools (viewRange) can’t convey, or when the user asks to see part of the workbook. The bytes are ready to attach to a multimodal message or write to a file; this tool does no LLM wiring itself.

Gridlines and row/column headers render as Excel shows them. Renders against the browser’s native canvas when available, and skia-canvas in Node.

ParameterTypeDescription
referencestringrequiredA1 range to capture, sheet-qualified where needed (e.g. “‘LBO Model’!B40:N80”). A single cell is allowed.
headersbooleanoptionalDraw row/column headers (A, B, C … / 1, 2, 3 …). (default: true)
scalenumberoptionalOutput pixel density for headless (Node/Worker) rendering — 2 = crisp/retina. Ignored on a browser main thread, where the display’s devicePixelRatio governs. (default: 2)