Skip to main content
Glama
hyunjae-labs

xlwings Excel MCP Server

by hyunjae-labs

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
EXCEL_MCP_VISIBLENoShow Excel windowsfalse
EXCEL_MCP_CALC_MODENoCalculation modeautomatic
EXCEL_MCP_DEBUG_LOGNoEnable debug logging0
EXCEL_MCP_SESSION_TTLNoSession TTL in seconds600
EXCEL_MCP_MAX_SESSIONSNoMaximum concurrent sessions8

Capabilities

Server capabilities have not been inspected yet.

Tools

Functions exposed to the LLM to take actions

NameDescription
open_workbook
Open an Excel workbook and create a session.

Args:
    filepath: Path to Excel file
    visible: Whether to show Excel window (default: False)
    read_only: Whether to open in read-only mode (default: False)
    
Returns:
    Dictionary with session_id, filepath, visible, read_only, and sheets
close_workbook
Close a workbook session.

Args:
    session_id: Session ID from open_workbook
    save: Whether to save changes (default: True)
    
Returns:
    Success message
list_workbooks
List all open workbook sessions.

Returns:
    List of session information dictionaries
force_close_workbook_by_path_tool
Force close a specific workbook by file path (without saving).

Args:
    filepath: Path to the workbook to force close
    
Returns:
    Dictionary with 'closed' (bool) and 'message' (str)
apply_formula
Apply Excel formula to cell.

Args:
    session_id: Session ID from open_workbook (required)
    sheet_name: Name of worksheet
    cell: Cell address (e.g., "A1")
    formula: Excel formula to apply
validate_formula_syntax
Validate Excel formula syntax without applying it.

Args:
    sheet_name: Name of worksheet
    cell: Cell address (e.g., "A1")
    formula: Excel formula to validate
    session_id: Session ID from open_workbook (preferred)
    filepath: Path to Excel file (legacy, deprecated)
    
Note: Use session_id for better performance. filepath parameter is deprecated.
format_range
Apply formatting to a range of cells.

Args:
    sheet_name: Name of worksheet
    start_cell: Starting cell
    session_id: Session ID from open_workbook (preferred)
    filepath: Path to Excel file (legacy, deprecated)
    end_cell: Ending cell (optional)
    bold: Apply bold formatting
    italic: Apply italic formatting
    underline: Apply underline formatting
    font_size: Font size
    font_color: Font color
    bg_color: Background color
    border_style: Border style
    border_color: Border color
    number_format: Number format
    alignment: Text alignment
    wrap_text: Enable text wrapping
    merge_cells: Merge cells in range
    protection: Cell protection settings (optional)
    conditional_format: Conditional formatting settings (optional)
    
Note: Use session_id for better performance. filepath parameter is deprecated.
read_data_from_excel
Read data from Excel worksheet with cell metadata including validation rules.

Args:
    session_id: Session ID from open_workbook (required)
    sheet_name: Name of worksheet
    start_cell: Starting cell (default A1)
    end_cell: Ending cell (optional, auto-expands if not provided)
    preview_only: Whether to return preview only
write_data_to_excel
Write data to Excel worksheet.
Excel formula will write to cell without any verification.

Args:
    session_id: Session ID from open_workbook (required)
    sheet_name: Name of worksheet to write to
    data: List of lists containing data to write to the worksheet, sublists are assumed to be rows
    start_cell: Cell to start writing to (optional, auto-finds appropriate location)
create_workbook
Create new Excel workbook.

Args:
    session_id: Session ID for creating workbook in existing session (optional)
    filepath: Path to create new Excel file (legacy, deprecated)
    
Note: Use session_id for better performance. filepath parameter is deprecated.
create_worksheet
Create new worksheet in workbook.

Args:
    session_id: Session ID from open_workbook (required)
    sheet_name: Name of the new worksheet
create_chart
Create chart in worksheet.

Args:
    sheet_name: Name of worksheet
    data_range: Data range for chart
    chart_type: Type of chart
    target_cell: Cell where chart will be placed
    session_id: Session ID from open_workbook (preferred)
    filepath: Path to Excel file (legacy, deprecated)
    title: Chart title (optional)
    x_axis: X-axis label (optional)
    y_axis: Y-axis label (optional)
    
Note: Use session_id for better performance. filepath parameter is deprecated.
create_pivot_table
Create pivot table in worksheet.

Args:
    sheet_name: Name of worksheet containing source data
    data_range: Source data range (e.g., "A1:E100" or "Sheet2!A1:E100")
    rows: Field names for row labels
    values: Field names for values
    session_id: Session ID from open_workbook (preferred)
    filepath: Path to Excel file (legacy, deprecated)
    columns: Field names for column labels (optional)
    agg_func: Aggregation function (sum, count, average, max, min)
    target_sheet: Target sheet for pivot table (optional, auto-created if not exists)
    target_cell: Target cell for pivot table (optional, finds empty area if not provided)
    pivot_name: Custom name for pivot table (optional, auto-generated if not provided)
    
Note: Use session_id for better performance. filepath parameter is deprecated.
create_table
Creates a native Excel table from a specified range of data.

Args:
    sheet_name: Name of worksheet
    data_range: Range of data to create table from
    session_id: Session ID from open_workbook (preferred)
    filepath: Path to Excel file (legacy, deprecated)
    table_name: Name for the table (optional)
    table_style: Style for the table (optional)
    
Note: Use session_id for better performance. filepath parameter is deprecated.
copy_worksheet
Copy worksheet within workbook.

Args:
    session_id: Session ID from open_workbook (required)
    source_sheet: Name of the source worksheet
    target_sheet: Name of the target worksheet
delete_worksheet
Delete worksheet from workbook.

Args:
    session_id: Session ID from open_workbook (required)
    sheet_name: Name of the worksheet to delete
rename_worksheet
Rename worksheet in workbook.

Args:
    session_id: Session ID from open_workbook (required)
    old_name: Current name of the worksheet
    new_name: New name for the worksheet
get_workbook_metadata
Get metadata about workbook including sheets, ranges, etc.

Args:
    session_id: Session ID from open_workbook (required)
    include_ranges: Whether to include range information
merge_cells
Merge a range of cells.

Args:
    sheet_name: Name of worksheet
    start_cell: Starting cell
    end_cell: Ending cell
    session_id: Session ID from open_workbook (preferred)
    filepath: Path to Excel file (legacy, deprecated)
    
Note: Use session_id for better performance. filepath parameter is deprecated.
unmerge_cells
Unmerge a range of cells.

Args:
    sheet_name: Name of worksheet
    start_cell: Starting cell
    end_cell: Ending cell
    session_id: Session ID from open_workbook (preferred)
    filepath: Path to Excel file (legacy, deprecated)
    
Note: Use session_id for better performance. filepath parameter is deprecated.
get_merged_cells
Get merged cells in a worksheet.

Args:
    sheet_name: Name of worksheet
    session_id: Session ID from open_workbook (preferred)
    filepath: Path to Excel file (legacy, deprecated)
    
Note: Use session_id for better performance. filepath parameter is deprecated.
copy_range
Copy a range of cells to another location.

Args:
    sheet_name: Name of source worksheet
    source_start: Starting cell of source range
    source_end: Ending cell of source range
    target_start: Starting cell of target range
    session_id: Session ID from open_workbook (preferred)
    filepath: Path to Excel file (legacy, deprecated)
    target_sheet: Target worksheet (optional, uses source sheet if not provided)
    
Note: Use session_id for better performance. filepath parameter is deprecated.
delete_range
Delete a range of cells and shift remaining cells.

Args:
    sheet_name: Name of worksheet
    start_cell: Starting cell
    end_cell: Ending cell
    session_id: Session ID from open_workbook (preferred)
    filepath: Path to Excel file (legacy, deprecated)
    shift_direction: Direction to shift cells ("up" or "left")
    
Note: Use session_id for better performance. filepath parameter is deprecated.
validate_excel_range
Validate if a range exists and is properly formatted.

Args:
    sheet_name: Name of worksheet
    start_cell: Starting cell
    session_id: Session ID from open_workbook (preferred)
    filepath: Path to Excel file (legacy, deprecated)
    end_cell: Ending cell (optional)
    
Note: Use session_id for better performance. filepath parameter is deprecated.
get_data_validation_info
Get all data validation rules in a worksheet.

This tool helps identify which cell ranges have validation rules
and what types of validation are applied.

Args:
    sheet_name: Name of worksheet
    session_id: Session ID from open_workbook (preferred)
    filepath: Path to Excel file (legacy, deprecated)
    
Note: Use session_id for better performance. filepath parameter is deprecated.
    
Returns:
    JSON string containing all validation rules in the worksheet
insert_rows
Insert one or more rows starting at the specified row.

Args:
    sheet_name: Name of worksheet
    start_row: Row number to start inserting at
    session_id: Session ID from open_workbook (preferred)
    filepath: Path to Excel file (legacy, deprecated)
    count: Number of rows to insert
    
Note: Use session_id for better performance. filepath parameter is deprecated.
insert_columns
Insert one or more columns starting at the specified column.

Args:
    sheet_name: Name of worksheet
    start_col: Column number to start inserting at
    session_id: Session ID from open_workbook (preferred)
    filepath: Path to Excel file (legacy, deprecated)
    count: Number of columns to insert
    
Note: Use session_id for better performance. filepath parameter is deprecated.
delete_sheet_rows
Delete one or more rows starting at the specified row.

Args:
    sheet_name: Name of worksheet
    start_row: Row number to start deleting from
    session_id: Session ID from open_workbook (preferred)
    filepath: Path to Excel file (legacy, deprecated)
    count: Number of rows to delete
    
Note: Use session_id for better performance. filepath parameter is deprecated.
delete_sheet_columns
Delete one or more columns starting at the specified column.

Args:
    sheet_name: Name of worksheet
    start_col: Column number to start deleting from
    session_id: Session ID from open_workbook (preferred)
    filepath: Path to Excel file (legacy, deprecated)
    count: Number of columns to delete
    
Note: Use session_id for better performance. filepath parameter is deprecated.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hyunjae-labs/xlwings-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server