10 KiB
Excel MCP Server Tools
This document provides detailed information about all available tools in the Excel MCP server.
Workbook Operations
create_workbook
Creates a new Excel workbook.
create_workbook(filepath: str) -> str
filepath: Path where to create workbook- Returns: Success message with created file path
create_worksheet
Creates a new worksheet in an existing workbook.
create_worksheet(filepath: str, sheet_name: str) -> str
filepath: Path to Excel filesheet_name: Name for the new worksheet- Returns: Success message
get_workbook_metadata
Get metadata about workbook including sheets and ranges.
get_workbook_metadata(filepath: str, include_ranges: bool = False) -> str
filepath: Path to Excel fileinclude_ranges: Whether to include range information- Returns: String representation of workbook metadata
Data Operations
write_data_to_excel
Write data to Excel worksheet.
write_data_to_excel(
filepath: str,
sheet_name: str,
data: List[Dict],
start_cell: str = "A1"
) -> str
filepath: Path to Excel filesheet_name: Target worksheet namedata: List of dictionaries containing data to writestart_cell: Starting cell (default: "A1")- Returns: Success message
read_data_from_excel
Read data from Excel worksheet.
read_data_from_excel(
filepath: str,
sheet_name: str,
start_cell: str = "A1",
end_cell: str = None,
preview_only: bool = False
) -> str
filepath: Path to Excel filesheet_name: Source worksheet namestart_cell: Starting cell (default: "A1")end_cell: Optional ending cellpreview_only: Whether to return only a preview- Returns: String representation of data
Formatting Operations
format_range
Apply formatting to a range of cells.
format_range(
filepath: str,
sheet_name: str,
start_cell: str,
end_cell: str = None,
bold: bool = False,
italic: bool = False,
underline: bool = False,
font_size: int = None,
font_color: str = None,
bg_color: str = None,
border_style: str = None,
border_color: str = None,
number_format: str = None,
alignment: str = None,
wrap_text: bool = False,
merge_cells: bool = False,
protection: Dict[str, Any] = None,
conditional_format: Dict[str, Any] = None
) -> str
filepath: Path to Excel filesheet_name: Target worksheet namestart_cell: Starting cell of rangeend_cell: Optional ending cell of range- Various formatting options (see parameters)
- Returns: Success message
merge_cells
Merge a range of cells.
merge_cells(filepath: str, sheet_name: str, start_cell: str, end_cell: str) -> str
filepath: Path to Excel filesheet_name: Target worksheet namestart_cell: Starting cell of rangeend_cell: Ending cell of range- Returns: Success message
unmerge_cells
Unmerge a previously merged range of cells.
unmerge_cells(filepath: str, sheet_name: str, start_cell: str, end_cell: str) -> str
filepath: Path to Excel filesheet_name: Target worksheet namestart_cell: Starting cell of rangeend_cell: Ending cell of range- Returns: Success message
get_merged_cells
Get merged cells in a worksheet.
get_merged_cells(filepath: str, sheet_name: str) -> str
filepath: Path to Excel filesheet_name: Target worksheet name- Returns: String representation of merged cells
Formula Operations
apply_formula
Apply Excel formula to cell.
apply_formula(filepath: str, sheet_name: str, cell: str, formula: str) -> str
filepath: Path to Excel filesheet_name: Target worksheet namecell: Target cell referenceformula: Excel formula to apply- Returns: Success message
validate_formula_syntax
Validate Excel formula syntax without applying it.
validate_formula_syntax(filepath: str, sheet_name: str, cell: str, formula: str) -> str
filepath: Path to Excel filesheet_name: Target worksheet namecell: Target cell referenceformula: Excel formula to validate- Returns: Validation result message
Chart Operations
create_chart
Create chart in worksheet.
create_chart(
filepath: str,
sheet_name: str,
data_range: str,
chart_type: str,
target_cell: str,
title: str = "",
x_axis: str = "",
y_axis: str = ""
) -> str
filepath: Path to Excel filesheet_name: Target worksheet namedata_range: Range containing chart datachart_type: Type of chart (line, bar, pie, scatter, area)target_cell: Cell where to place charttitle: Optional chart titlex_axis: Optional X-axis labely_axis: Optional Y-axis label- Returns: Success message
Pivot Table Operations
create_pivot_table
Create pivot table in worksheet.
create_pivot_table(
filepath: str,
sheet_name: str,
data_range: str,
target_cell: str,
rows: List[str],
values: List[str],
columns: List[str] = None,
agg_func: str = "mean"
) -> str
filepath: Path to Excel filesheet_name: Target worksheet namedata_range: Range containing source datatarget_cell: Cell where to place pivot tablerows: Fields for row labelsvalues: Fields for valuescolumns: Optional fields for column labelsagg_func: Aggregation function (sum, count, average, max, min)- Returns: Success message
Table Operations
create_table
Creates a native Excel table from a specified range of data.
create_table(
filepath: str,
sheet_name: str,
data_range: str,
table_name: str = None,
table_style: str = "TableStyleMedium9"
) -> str
filepath: Path to the Excel file.sheet_name: Name of the worksheet.data_range: The cell range for the table (e.g., "A1:D5").table_name: Optional unique name for the table.table_style: Optional visual style for the table.- Returns: Success message.
Worksheet Operations
copy_worksheet
Copy worksheet within workbook.
copy_worksheet(filepath: str, source_sheet: str, target_sheet: str) -> str
filepath: Path to Excel filesource_sheet: Name of sheet to copytarget_sheet: Name for new sheet- Returns: Success message
delete_worksheet
Delete worksheet from workbook.
delete_worksheet(filepath: str, sheet_name: str) -> str
filepath: Path to Excel filesheet_name: Name of sheet to delete- Returns: Success message
rename_worksheet
Rename worksheet in workbook.
rename_worksheet(filepath: str, old_name: str, new_name: str) -> str
filepath: Path to Excel fileold_name: Current sheet namenew_name: New sheet name- Returns: Success message
Range Operations
copy_range
Copy a range of cells to another location.
copy_range(
filepath: str,
sheet_name: str,
source_start: str,
source_end: str,
target_start: str,
target_sheet: str = None
) -> str
filepath: Path to Excel filesheet_name: Source worksheet namesource_start: Starting cell of source rangesource_end: Ending cell of source rangetarget_start: Starting cell for pastetarget_sheet: Optional target worksheet name- Returns: Success message
delete_range
Delete a range of cells and shift remaining cells.
delete_range(
filepath: str,
sheet_name: str,
start_cell: str,
end_cell: str,
shift_direction: str = "up"
) -> str
filepath: Path to Excel filesheet_name: Target worksheet namestart_cell: Starting cell of rangeend_cell: Ending cell of rangeshift_direction: Direction to shift cells ("up" or "left")- Returns: Success message
validate_excel_range
Validate if a range exists and is properly formatted.
validate_excel_range(
filepath: str,
sheet_name: str,
start_cell: str,
end_cell: str = None
) -> str
filepath: Path to Excel filesheet_name: Target worksheet namestart_cell: Starting cell of rangeend_cell: Optional ending cell of range- Returns: Validation result message
get_data_validation_info
Get data validation rules and metadata for a worksheet.
get_data_validation_info(filepath: str, sheet_name: str) -> str
filepath: Path to Excel filesheet_name: Target worksheet name- Returns: JSON string containing all data validation rules with metadata including:
- Validation type (list, whole, decimal, date, time, textLength)
- Operator (between, notBetween, equal, greaterThan, lessThan, etc.)
- Allowed values for list validations (resolved from ranges)
- Formula constraints for numeric/date validations
- Cell ranges where validation applies
- Prompt and error messages
Note: The read_data_from_excel tool automatically includes validation metadata for individual cells when available.
Row and Column Operations
insert_rows
Insert one or more rows starting at the specified row.
insert_rows(
filepath: str,
sheet_name: str,
start_row: int,
count: int = 1
) -> str
filepath: Path to Excel filesheet_name: Target worksheet namestart_row: Row number where to start inserting (1-based)count: Number of rows to insert (default: 1)- Returns: Success message
insert_columns
Insert one or more columns starting at the specified column.
insert_columns(
filepath: str,
sheet_name: str,
start_col: int,
count: int = 1
) -> str
filepath: Path to Excel filesheet_name: Target worksheet namestart_col: Column number where to start inserting (1-based)count: Number of columns to insert (default: 1)- Returns: Success message
delete_sheet_rows
Delete one or more rows starting at the specified row.
delete_sheet_rows(
filepath: str,
sheet_name: str,
start_row: int,
count: int = 1
) -> str
filepath: Path to Excel filesheet_name: Target worksheet namestart_row: Row number where to start deleting (1-based)count: Number of rows to delete (default: 1)- Returns: Success message
delete_sheet_columns
Delete one or more columns starting at the specified column.
delete_sheet_columns(
filepath: str,
sheet_name: str,
start_col: int,
count: int = 1
) -> str
filepath: Path to Excel filesheet_name: Target worksheet namestart_col: Column number where to start deleting (1-based)count: Number of columns to delete (default: 1)- Returns: Success message