excel

package
v1.2.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 16, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package excel provides a structured cell-range editor for XLSX spreadsheets, the write-side counterpart to internal/officetext's native XLSX read support. Text-oriented tools (write_file/edit_file) don't apply here - a spreadsheet is a grid of typed cells and formulas, not a string to append/replace - so this is a separate tool with its own input shape, modeled on DesktopCommanderMCP's ExcelFileHandler.editRange (write a 2D block of values starting at a given cell, formulas included) rather than bolted onto an existing text-editing tool.

Index

Constants

View Source
const (
	// ToolName is the name of the Excel edit tool.
	ToolName = "excel_edit"

	// SearchHint is a hint for tool search functionality.
	SearchHint = "write or edit cells in an Excel (.xlsx) spreadsheet"

	// ToolDescription is the description of the excel_edit tool.
	ToolDescription = "Write values (and formulas) into an Excel (.xlsx) spreadsheet, creating the file or sheet if they don't exist yet.\n\n" +
		"## When to use\n\n" +
		"- Creating a new .xlsx file with data\n" +
		"- Updating specific cells or a block of cells in an existing spreadsheet\n" +
		"- Writing formulas (any value starting with \"=\" is set as a formula, e.g. \"=SUM(A1:A10)\")\n\n" +
		"## When NOT to use\n\n" +
		"- Reading spreadsheet content — use FileRead instead (it extracts .xlsx natively, no need to write anything first)\n" +
		"- Plain CSV/text data — use FileWrite\n\n" +
		"## Rules\n\n" +
		"- values is a 2D array (rows of cells): [[\"Name\", \"Score\"], [\"Alice\", 90], [\"Bob\", 85]]\n" +
		"- range is the top-left cell to start writing at (e.g. \"B2\"); values fills out from there row by row, column by column. Omit it to start at A1.\n" +
		"- sheet defaults to the workbook's first sheet; naming a sheet that doesn't exist yet creates it.\n" +
		"- If the file already exists, you must read it with FileRead first (same rule as FileWrite) — this tool errors otherwise, since a spreadsheet write can silently clobber other cells' formulas/formatting if made blind.\n"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Tool

type Tool struct {
	// contains filtered or unexported fields
}

Tool implements the excel_edit tool.

func NewTool

func NewTool(workingDir string) *Tool

NewTool creates a new Excel edit tool.

func (*Tool) BackfillInput

func (t *Tool) BackfillInput(_ context.Context, input map[string]any) map[string]any

func (*Tool) Call

func (t *Tool) Call(
	ctx context.Context,
	input tool.CallInput,
	permissionCheck types.CanUseToolFn,
) (tool.CallResult, error)

func (*Tool) CheckPermissions

func (t *Tool) CheckPermissions(_ context.Context, input map[string]any, toolCtx tool.ToolUseContext) types.PermissionResult

func (*Tool) Definition

func (t *Tool) Definition() tool.Definition

func (*Tool) Description

func (t *Tool) Description(_ context.Context) (string, error)

func (*Tool) FormatResult

func (t *Tool) FormatResult(data any) string

func (*Tool) IsConcurrencySafe

func (t *Tool) IsConcurrencySafe(_ map[string]any) bool

func (*Tool) IsEnabled

func (t *Tool) IsEnabled() bool

func (*Tool) IsReadOnly

func (t *Tool) IsReadOnly(_ map[string]any) bool

func (*Tool) ValidateInput

func (t *Tool) ValidateInput(_ context.Context, input map[string]any) (map[string]any, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL