mcp-server-spreadsheet
v0.3.3MCP server for spreadsheet files (.xlsx, .csv, .ods) - cell-level ops + DuckDB SQL engine.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
list_workbooks
List all spreadsheet files (.xlsx, .csv, .ods) in a directory (non-recursive). Returns the full path of each file found, sorted alphabetically.
| Parameter | Type | Description |
|---|---|---|
directory * | string | Absolute or relative path to the directory to scan |
create_workbook_file
Create a new empty spreadsheet file at the given path. The file format is determined by the extension (.xlsx, .csv, or .ods). The file must not already exist. Returns the absolute path of the created file.
| Parameter | Type | Description |
|---|---|---|
file * | string | Path where the new file will be created (.csv, .ods, .xlsx). Must not already exist. |
sheet_name | Name for the initial sheet. Defaults to 'Sheet' for xlsx/ods, 'default' for csv. |
copy_workbook
Copy an existing spreadsheet file to a new location. Performs a full file copy preserving all data. The destination must not already exist. Returns the absolute path of the new file.
| Parameter | Type | Description |
|---|---|---|
destination * | string | Path for the new copy. Must not already exist. |
source * | string | Path to the existing spreadsheet file to copy |
list_sheets
List all sheet names in a workbook, in workbook order. Returns a list of sheet name strings. CSV files always return a single sheet named 'default'.
| Parameter | Type | Description |
|---|---|---|
file * | string | Path to the spreadsheet file |
add_sheet
Add a new sheet to the workbook. Returns the name of the newly created sheet. Not supported for CSV files.
| Parameter | Type | Description |
|---|---|---|
file * | string | Path to the spreadsheet file |
name | Name for the new sheet. Auto-generated if omitted. | |
position | 1-based position to insert the sheet. Appended at the end if omitted. |
rename_sheet
Rename an existing sheet in the workbook. Returns the new sheet name on success.
| Parameter | Type | Description |
|---|---|---|
file * | string | Path to the spreadsheet file |
new_name * | string | New name for the sheet |
old_name * | string | Current name of the sheet to rename |
delete_sheet
Delete a sheet by name from the workbook. All data in the sheet is permanently removed. Not supported for CSV files.
| Parameter | Type | Description |
|---|---|---|
file * | string | Path to the spreadsheet file |
name * | string | Name of the sheet to delete |
copy_sheet
Duplicate a sheet within the same workbook. Copies all cell values. Returns the name of the new sheet. Not supported for CSV files.
| Parameter | Type | Description |
|---|---|---|
file * | string | Path to the spreadsheet file |
source_name * | string | Name of the existing sheet to duplicate |
new_name | Name for the copy. Auto-generated if omitted. | |
position | 1-based position for the copied sheet. Placed at the end if omitted. |
read_sheet
Read an entire sheet (or a bounded sub-region) as a list of rows. Each row is a list of cell values. Empty cells appear as null. Use the optional row/column bounds to limit output for large sheets.
| Parameter | Type | Description |
|---|---|---|
file * | string | Path to the spreadsheet file |
end_column | Last column to include (1-based). Defaults to the last used column. | |
end_row | Last row to include (1-based). Defaults to the last used row. | |
sheet | Sheet name. Defaults to the first sheet if omitted. | |
start_column | First column to include (1-based, e.g. 1 = A). Defaults to the first used column. | |
start_row | First row to include (1-based). Defaults to the first used row. |
read_cell
Read the value of a single cell. Returns the cell's value: numbers as int/float, text as string, and empty cells as null.
| Parameter | Type | Description |
|---|---|---|
cell * | string | Cell reference in A1 notation, e.g. 'B3' or '$B$3' |
file * | string | Path to the spreadsheet file |
sheet | Sheet name. Defaults to the first sheet if omitted. |
read_range
Read a rectangular range of cells as a list of rows. Returns a 2D array where each inner list is one row of values. Empty cells return null.
| Parameter | Type | Description |
|---|---|---|
file * | string | Path to the spreadsheet file |
range_str * | string | Cell range in A1 notation, e.g. 'A1:D10' or '$A$1:$D$10' |
sheet | Sheet name. Defaults to the first sheet if omitted. |
get_sheet_dimensions
Get the dimensions of the used range in a sheet. Returns {"rows": N, "columns": M} where N is the number of the last used row and M is the number of the last used column. Both are 0 for an empty sheet.
| Parameter | Type | Description |
|---|---|---|
file * | string | Path to the spreadsheet file |
sheet | Sheet name. Defaults to the first sheet if omitted. |
write_cell
Write a single value to a cell. Overwrites any existing value. The value is type-coerced: numeric strings become numbers, all else is text.
| Parameter | Type | Description |
|---|---|---|
cell * | string | Target cell in A1 notation, e.g. 'B3' |
file * | string | Path to the spreadsheet file |
value * | Value to write. Numeric strings are coerced to numbers, everything else is stored as text. | |
sheet | Sheet name. Defaults to the first sheet if omitted. |
write_range
Write a 2D array of values into a rectangular region. Writing starts at start_cell and expands right and down to fit the data. Prefer this over multiple write_cell calls for efficiency.
| Parameter | Type | Description |
|---|---|---|
data * | array | 2D array of values (list of rows), e.g. [[1, 2, 3], ['a', 'b', 'c']]. Numeric strings are coerced to numbers. |
file * | string | Path to the spreadsheet file |
start_cell * | string | Top-left cell where writing begins, e.g. 'B2' |
sheet | Sheet name. Defaults to the first sheet if omitted. |
append_rows
Append one or more rows after the last used row in the sheet. Values are type-coerced (numeric strings to numbers). This is the most efficient way to add data to the end of a sheet.
| Parameter | Type | Description |
|---|---|---|
data * | array | List of rows to append, e.g. [['Alice', 30], ['Bob', 25]]. Each inner list is one row. |
file * | string | Path to the spreadsheet file |
sheet | Sheet name. Defaults to the first sheet if omitted. |
insert_rows
Insert rows at a given position, shifting existing rows down. If data is provided, the inserted rows are filled with those values (type-coerced). Otherwise the rows are left blank.
| Parameter | Type | Description |
|---|---|---|
file * | string | Path to the spreadsheet file |
row * | integer | 1-based row index where new rows will be inserted. Existing rows at and below this index shift down. |
count | integer | Number of rows to insert. If data is provided and longer, enough rows are inserted to fit the data. |
data | Optional 2D array of values to fill the inserted rows. Leave empty for blank rows. | |
sheet | Sheet name. Defaults to the first sheet if omitted. |
delete_rows
Delete one or more rows, shifting remaining rows up. All data in the deleted rows is permanently removed.
| Parameter | Type | Description |
|---|---|---|
file * | string | Path to the spreadsheet file |
row * | integer | 1-based index of the first row to delete |
count | integer | Number of consecutive rows to delete starting from row |
sheet | Sheet name. Defaults to the first sheet if omitted. |
clear_range
Clear all cell values in a range without removing rows or columns. Sets every cell in the range to null. Row/column structure is preserved.
| Parameter | Type | Description |
|---|---|---|
file * | string | Path to the spreadsheet file |
range_str * | string | Range to clear in A1 notation, e.g. 'A1:D10'. Only values are removed. |
sheet | Sheet name. Defaults to the first sheet if omitted. |
copy_range
Copy a rectangular block of cells to another location. Copies raw values only. The destination can be on the same sheet or a different sheet in the same workbook. Existing values at the destination are overwritten.
| Parameter | Type | Description |
|---|---|---|
dest_start * | string | Top-left cell of the destination, e.g. 'E1'. The copied block expands right and down from here. |
file * | string | Path to the spreadsheet file |
source_range * | string | Range to copy from in A1 notation, e.g. 'A1:C5' |
dest_sheet | Destination sheet name. Defaults to the same sheet as the source if omitted. | |
sheet | Source sheet name. Defaults to the first sheet if omitted. |
insert_columns
Insert one or more blank columns, shifting existing columns right.
| Parameter | Type | Description |
|---|---|---|
column * | integer | 1-based column index where new columns will be inserted (e.g. 1 = A, 2 = B). Existing columns at and to the right shift right. |
file * | string | Path to the spreadsheet file |
count | integer | Number of blank columns to insert |
sheet | Sheet name. Defaults to the first sheet if omitted. |
delete_columns
Delete one or more columns, shifting remaining columns left.
| Parameter | Type | Description |
|---|---|---|
column * | integer | 1-based index of the first column to delete (e.g. 1 = A, 2 = B) |
file * | string | Path to the spreadsheet file |
count | integer | Number of consecutive columns to delete starting from column |
sheet | Sheet name. Defaults to the first sheet if omitted. |
search_sheet
Search all cells in a sheet for values matching a regex pattern. Returns a list of matches, each with the cell reference and value, e.g. [{"cell": "B3", "value": "hello"}, ...]. Returns an empty list if no matches are found.
| Parameter | Type | Description |
|---|---|---|
file * | string | Path to the spreadsheet file |
pattern * | string | Regular expression pattern to search for. Matched against the string representation of each cell value. |
sheet | Sheet name. Defaults to the first sheet if omitted. |
describe_table
Inspect the structure of a sheet treated as a database table. Returns column names, inferred data types (text, integer, number, boolean, date), total row count, and sample values from the first 3 data rows. Use this before writing SQL queries to understand the available columns and their types. When sheet is omitted, returns a list of descriptions for all sheets.
| Parameter | Type | Description |
|---|---|---|
file * | string | Path to the spreadsheet file |
data_start_row | 1-based row where data begins. Use this to skip rows (e.g. a units row) between the header and data. Int or per-sheet mapping. Defaults to header_row + 1. | |
header_row | 1-based row number containing column headers, or a per-sheet mapping like {"Sales": 1, "Forecast": 4}. Sheets not listed default to 1. | |
sheet | Sheet name to describe. If omitted, describes all sheets in the workbook. |
sql_query
Execute a read-only SQL SELECT query against the spreadsheet data. Every sheet in the workbook is loaded as a database table, with the header row defining column names and data rows below it. Returns results as a list of {column: value} objects. Only SELECT (and WITH ... SELECT) statements are accepted. Use sql_execute for INSERT, UPDATE, or DELETE.
| Parameter | Type | Description |
|---|---|---|
file * | string | Path to the spreadsheet file |
sql * | string | SQL SELECT statement to execute. Each sheet is a table (quote names with double quotes if they contain spaces). Supports WHERE, ORDER BY, LIMIT, GROUP BY, HAVING, JOINs across sheets, DISTINCT, UNION,… |
data_start_row | 1-based row where data begins. Use this to skip rows (e.g. a units row) between the header and data. Int or per-sheet mapping. Defaults to header_row + 1. | |
header_row | 1-based row number containing column headers, or a per-sheet mapping like {"Sales": 1, "Forecast": 4}. Sheets not listed default to 1. |
sql_execute
Execute a mutating SQL statement and write changes back to the file. Supports INSERT INTO (adds rows), UPDATE (modifies cell values), and DELETE FROM (removes rows). The target sheet is determined from the SQL statement. After execution, the modified table is written back to the file atomically. Returns {"affected_rows": N}.
| Parameter | Type | Description |
|---|---|---|
file * | string | Path to the spreadsheet file |
sql * | string | SQL mutation statement to execute: INSERT INTO, UPDATE, or DELETE FROM. Sheet names are table names. Example: UPDATE Sales SET status = 'Closed' WHERE quarter = 'Q1' AND revenue < 1000 |
data_start_row | 1-based row where data begins. Use this to skip rows (e.g. a units row) between the header and data. Int or per-sheet mapping. Defaults to header_row + 1. | |
header_row | 1-based row number containing column headers, or a per-sheet mapping like {"Sales": 1, "Forecast": 4}. Sheets not listed default to 1. |