read_cells
Read Excel worksheet cell data as single values, rectangular ranges, or chunked streams. Choose a mode to also include formulas, metadata, and style information.
Instructions
Read cell data from a worksheet.
Args:
mode: One of "single", "range", or "chunked". Determines the behaviour and required parameters.
- "single": returns a single cell value. Requires cell_ref.
- "range": returns a rectangular range. Requires start_cell and end_cell.
- "chunked": returns a chunked reader result for large sheets. Optional: start_row, chunk_size.
file_path: Path to the workbook (validated by utils).
sheet_name: Worksheet name.
cell_ref: Cell reference for single-cell reads (e.g. "A1").
start_cell: Top-left cell for range reads.
end_cell: Bottom-right cell for range reads.
include_formula: If True, include formula text when available.
include_metadata: If True, include additional metadata (styles, comment presence, etc.).
show_formula: For range reads, include formulas instead of values when True.
show_style: For range reads, include style information when True.
output_format: Format for range output; typically "json".
max_cells: Maximum cells to return for range reads (to avoid huge payloads).
start_row: For chunked reads, starting row index (0-based).
chunk_size: Number of rows per chunk for chunked reads.
Returns:
dict or ChunkReadResult: Single value, range payload, or chunked reader object depending on mode.
Raises:
ValueError: If required parameters for the chosen mode are missing or mode is unknown.
Notes:
- Read-only: this function only reads workbook data and should not mutate files.
- Dispatch mapping: "single"→tools.cell_ops.read_cell, "range"→tools.cell_ops.read_range, "chunked"→tools.cell_ops.read_file_chunked.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | Yes | ||
| cell_ref | No | ||
| end_cell | No | ||
| file_path | Yes | ||
| max_cells | No | ||
| start_row | No | ||
| chunk_size | No | ||
| sheet_name | Yes | ||
| show_style | No | ||
| start_cell | No | ||
| show_formula | No | ||
| output_format | No | json | |
| include_formula | No | ||
| include_metadata | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |