# Excel Mcp Server (`muhammadaashiq/excel-mcp-server`) Actor

Excel Mcp server with 200+ tools

- **URL**: https://apify.com/muhammadaashiq/excel-mcp-server.md
- **Developed by:** [Muhammad Aashiq](https://apify.com/muhammadaashiq) (community)
- **Categories:** AI, MCP servers, Automation
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-usage

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Excel Copilot MCP Server

A **219-tool** Model Context Protocol (MCP) server that gives AI agents full Excel superpowers — local `.xlsx` files, Microsoft 365 / OneDrive / SharePoint, and **live COM automation** for workbooks already open in Excel on Windows.

> **Pricing:** $0.001 per tool call (configured in `.actor/actor.json`)

---

### Table of Contents

- [Features](#features)
- [Quick Start](#quick-start)
- [Configuration](#configuration)
- [Tool Reference](#tool-reference)
  - [Local Excel Tools (openpyxl)](#local-excel-tools-openpyxl)
  - [Microsoft 365 / OneDrive Tools](#microsoft-365--onedrive-tools)
  - [Live Excel Tools (COM / xlwings)](#live-excel-tools-com--xlwings)
- [Project Structure](#project-structure)
- [Requirements](#requirements)
- [Apify Pricing](#apify-pricing)
- [Troubleshooting](#troubleshooting)

---

### Features

| Category | Tools | Description |
|----------|-------|-------------|
| Local Excel (openpyxl) | 34 | Read/write/format `.xlsx` files without Excel installed |
| Microsoft 365 / OneDrive | 9 | Authenticate, upload, read/write files on OneDrive & SharePoint |
| Live Excel (COM / xlwings) | 176 | Full automation of Excel workbooks open on Windows desktop |
| **Total** | **219** | |

---

### Quick Start

#### 1. Clone & Install

```bash
git clone https://github.com/your-org/excel-mcp-server.git
cd excel-mcp-server
pip install -r requirements.txt
````

#### 2. Configure Environment (optional — only for M365 tools)

Copy `.env.example` to `.env` and fill in your Azure App credentials:

```env
AZURE_CLIENT_ID=your-client-id
AZURE_TENANT_ID=your-tenant-id
AZURE_CLIENT_SECRET=your-client-secret
```

#### 3. Run the Server

```bash
python server.py
```

#### 4. Connect from VS Code (GitHub Copilot Chat)

Add to `.vscode/mcp.json` in your workspace:

```json
{
  "servers": {
    "excel-copilot": {
      "type": "stdio",
      "command": "python",
      "args": ["C:/path/to/excel-mcp-server/server.py"]
    }
  }
}
```

***

### Configuration

| Variable | Required | Description |
|----------|----------|-------------|
| `AZURE_CLIENT_ID` | No\* | Azure App Registration Client ID |
| `AZURE_TENANT_ID` | No\* | Azure AD Tenant ID |
| `AZURE_CLIENT_SECRET` | No\* | Azure App Client Secret |

\*Required only for Microsoft 365 / OneDrive tools.

**Azure App Permissions needed** (for M365 tools):

- `Files.ReadWrite.All`
- `Sites.ReadWrite.All`
- `User.Read`

***

### Tool Reference

#### Local Excel Tools (openpyxl)

These tools work on `.xlsx` files stored locally. Excel does **not** need to be installed.

##### Workbook & Sheet Operations

| Tool | Description |
|------|-------------|
| `create_workbook` | Create a new blank `.xlsx` workbook at a given path |
| `read_excel` | Read cell values from a range in a worksheet |
| `write_excel` | Write a 2-D list of values into a worksheet range |
| `fill_cells` | Fill individual cells with values (cell→value dict) |
| `add_formula` | Write a formula string into a specific cell |
| `list_sheets` | List all worksheet names and the active sheet |
| `create_sheet` | Add a new worksheet at an optional position |
| `delete_sheet` | Delete a worksheet by name |
| `rename_sheet` | Rename an existing worksheet |
| `copy_sheet` | Duplicate a worksheet within the same workbook |
| `search_in_excel` | Search all sheets for a value (exact or substring match) |
| `get_workbook_info` | Return metadata: file size, sheet names, named ranges |

##### Formatting & Layout

| Tool | Description |
|------|-------------|
| `format_cells` | Apply font, fill, border, alignment, and number format to a range |
| `set_column_width` | Set a specific column width in Excel units |
| `auto_fit_columns` | Auto-fit all columns to their content |
| `set_row_height` | Set the height of a specific row |
| `freeze_panes` | Freeze rows/columns above and to the left of a cell |
| `merge_cells` | Merge a cell range into a single cell |
| `unmerge_cells` | Un-merge a previously merged range |
| `get_merged_cells` | List all merged cell ranges in a worksheet |

##### Row & Column Operations

| Tool | Description |
|------|-------------|
| `insert_rows` | Insert blank rows at a given position |
| `insert_columns` | Insert blank columns at a given position |
| `delete_rows` | Delete rows at a given position |
| `delete_columns` | Delete columns at a given position |
| `copy_range` | Copy cell values from one range to another |
| `delete_range` | Clear/delete a range of cells |

##### Tables, Charts, Pivot & Validation

| Tool | Description |
|------|-------------|
| `create_chart` | Insert a bar, column, line, pie, area, or scatter chart |
| `create_table` | Create an Excel table from a cell range |
| `create_pivot_table` | Create a pivot table from a data range |
| `add_conditional_format` | Add a color-scale or data-bar conditional format rule |
| `validate_formula_syntax` | Check whether a formula string is syntactically valid |
| `validate_range` | Validate that a range address is well-formed |
| `get_data_validation_info` | Read data-validation rules on a range |
| `define_named_range` | Create a named range in the workbook |
| `delete_named_range` | Delete a named range by name |
| `list_named_ranges` | List all named ranges in the workbook |

***

#### Microsoft 365 / OneDrive Tools

Connect to Microsoft 365 via the Microsoft Graph API. Call `authenticate_m365` first.

| Tool | Description |
|------|-------------|
| `authenticate_m365` | Sign in using device-code flow (browser prompt) — must be called first |
| `upload_to_onedrive` | Upload a local `.xlsx` file to a OneDrive folder |
| `open_from_link` | Get workbook info from a SharePoint or OneDrive sharing URL |
| `read_m365_excel` | Read cell values from a OneDrive/SharePoint Excel file by item ID |
| `write_m365_excel` | Write values into a OneDrive/SharePoint Excel worksheet |
| `list_m365_sheets` | List worksheets in a OneDrive/SharePoint Excel file |
| `create_m365_workbook` | Create a new blank workbook in OneDrive |
| `create_share_link` | Generate a shareable link for a OneDrive/SharePoint file |
| `list_onedrive_files` | List Excel files in a OneDrive folder |

***

#### Live Excel Tools (COM / xlwings)

Control Excel workbooks **currently open on Windows** via COM automation. Excel must be installed and running.

##### Workbook Management

| Tool | Description |
|------|-------------|
| `open_excel_live` | Open an Excel file and connect via COM |
| `close_excel_live` | Close an open workbook (optionally save first) |
| `save_excel_live` | Save the active or named workbook |
| `attach_live_workbook` | Attach to an already-open workbook by name |
| `list_live_workbooks` | List all workbooks currently open in Excel |
| `list_all_excel_workbooks` | List every Excel file in a folder |
| `get_live_workbook_info` | Get sheet names, named ranges, and metadata |
| `get_live_workbook_properties` | Read workbook custom properties |
| `set_live_workbook_properties` | Write workbook custom properties |
| `protect_live_workbook` | Password-protect the workbook structure |
| `unprotect_live_workbook` | Remove workbook structure protection |
| `run_live_calculate` | Force recalculate all formulas |
| `export_live_to_pdf` | Export sheet(s) to PDF |
| `export_live_to_csv` | Export active sheet to CSV |
| `show_excel_window` | Make the Excel window visible |
| `hide_excel_window` | Hide the Excel window |
| `set_excel_status_bar` | Set text in Excel's status bar |
| `clear_excel_status_bar` | Clear the Excel status bar |
| `undo_live` | Undo the last action |
| `undo_all_live` | Undo all actions since last save |
| `run_vba_macro` | Run a named VBA macro in an open workbook |
| `run_live_vba` | Execute an arbitrary VBA code string |

##### Sheet Management

| Tool | Description |
|------|-------------|
| `add_live_sheet` | Add a new worksheet |
| `delete_live_sheet` | Delete a worksheet |
| `rename_live_sheet` | Rename a worksheet |
| `copy_live_sheet` | Duplicate a worksheet |
| `move_live_sheet` | Move a worksheet to a new position |
| `list_live_sheets` | List all worksheets with index and visibility |
| `hide_live_sheet` | Hide a worksheet |
| `unhide_live_sheet` | Unhide a worksheet |
| `set_live_tab_color` | Set the tab color of a worksheet (hex color) |
| `protect_live_sheet` | Password-protect a worksheet |
| `unprotect_live_sheet` | Remove worksheet protection |
| `freeze_live_panes` | Freeze rows/columns in a worksheet |
| `unfreeze_live_panes` | Remove freeze panes |
| `get_live_sheet_info` | Get row/column count and used range |
| `get_live_sheet_objects` | List all objects (charts, images, shapes) on a sheet |

##### Cell Read & Write

| Tool | Description |
|------|-------------|
| `read_live_cells` | Read cell values from a range |
| `write_live_cell` | Write a value or formula to a single cell |
| `fill_live_range` | Fill a range with a single value |
| `fill_live_cells` | Fill multiple specific cells with their respective values |
| `fill_live_series` | Auto-fill a series (numbers, dates, etc.) across a range |
| `get_live_formula` | Return the formula string from a cell |
| `add_live_formula` | Write a formula into a cell |
| `evaluate_live_formula` | Evaluate and return the result of a formula expression |
| `find_live_free_range` | Find the next empty range below existing data |
| `get_live_last_row` | Get the last row number with data in a column |
| `get_live_last_column` | Get the last column letter with data in a row |
| `get_live_used_range` | Get the address of the used range |
| `get_live_selection` | Get the currently selected range address |
| `set_live_selection` | Select a range in the worksheet |
| `navigate_live_cell` | Move the active cell to a given address |
| `get_live_cell_info` | Get value, formula, format, and type of a cell |
| `get_live_range_stats` | Get min, max, sum, average, and count for a range |
| `search_live_workbook` | Search all sheets for a value |

##### Formatting

| Tool | Description |
|------|-------------|
| `format_live_range` | Apply fill color, font color, bold/italic/underline to a range |
| `add_live_border` | Add borders around or inside a cell range |
| `get_live_cell_format` | Read all formatting properties of a cell |
| `set_live_font` | Set font name, size, bold, italic, underline, color |
| `set_live_number_format` | Set number format string (e.g. `#,##0.00`, `dd/mm/yyyy`) |
| `get_live_number_format` | Read the number format of a cell |
| `set_live_cell_alignment` | Set horizontal/vertical alignment and text orientation |
| `set_live_cell_style` | Apply a named Excel cell style |
| `set_live_text_wrap` | Enable or disable text wrap in a range |
| `copy_live_cell_format` | Copy formatting from one cell to another range |
| `clear_live_range` | Clear values and formatting from a range |
| `clear_live_range_contents` | Clear only the values from a range |
| `clear_live_range_format` | Clear only the formatting from a range |
| `set_live_zoom` | Set the worksheet zoom level (10–400%) |

##### Row & Column Operations

| Tool | Description |
|------|-------------|
| `insert_live_rows` | Insert blank rows at a position |
| `insert_live_columns` | Insert blank columns at a position |
| `delete_live_rows` | Delete rows at a position |
| `delete_live_columns` | Delete columns at a position |
| `hide_live_rows` | Hide a row range |
| `unhide_live_rows` | Unhide a row range |
| `hide_live_columns` | Hide a column range |
| `unhide_live_columns` | Unhide a column range |
| `set_live_column_width` | Set width of one or more columns |
| `set_live_row_height` | Set height of one or more rows |
| `autofit_live_columns` | Auto-fit column widths to content |
| `autofit_live_rows` | Auto-fit row heights to content |
| `group_live_rows` | Group rows for collapsing/expanding |
| `ungroup_live_rows` | Remove row grouping |
| `group_live_columns` | Group columns for collapsing/expanding |
| `ungroup_live_columns` | Remove column grouping |

##### Range Operations

| Tool | Description |
|------|-------------|
| `copy_live_range` | Copy a range (with formatting) to a target range |
| `copy_live_range_as_values` | Paste only values from source to target |
| `delete_live_range` | Delete a range and shift cells left or up |
| `move_live_range` | Cut and paste a range to a new location |
| `sort_live_range` | Sort a range by one or more columns |
| `filter_live_range` | Apply AutoFilter to a range |
| `clear_live_filter` | Clear AutoFilter from a worksheet |
| `find_and_replace_live` | Find and replace values in a range |
| `remove_live_duplicates` | Remove duplicate rows in a range |
| `paste_live_transpose` | Paste a range transposed (rows ↔ columns) |

##### Merge Operations

| Tool | Description |
|------|-------------|
| `merge_live_cells` | Merge a cell range |
| `unmerge_live_cells` | Un-merge a previously merged range |
| `get_live_merged_cells` | List all merged regions on a sheet |

##### Named Ranges

| Tool | Description |
|------|-------------|
| `define_live_named_range` | Create or update a named range |
| `delete_live_named_range` | Delete a named range |
| `list_live_named_ranges` | List all named ranges with their addresses |
| `update_live_named_range` | Update the reference address of a named range |
| `get_live_named_range_value` | Read the values in a named range |

##### Tables

| Tool | Description |
|------|-------------|
| `create_live_table` | Create an Excel table from a range |
| `delete_live_table` | Delete a table (and optionally its data) |
| `list_live_tables` | List all tables on a sheet or workbook |
| `rename_live_table` | Rename an existing table |
| `apply_live_table_style` | Apply a named table style |
| `toggle_live_table_total_row` | Show or hide the totals row |
| `convert_live_table_to_range` | Convert a table back to a plain range |
| `add_live_table_row` | Append a new row to a table |
| `get_live_table_data` | Read all data from a table including headers |

##### Charts

| Tool | Description |
|------|-------------|
| `create_live_chart` | Create a chart (bar, column, line, pie, scatter, area, etc.) |
| `delete_live_chart` | Delete a chart by name or index |
| `list_live_charts` | List all charts on a sheet |
| `update_live_chart_title` | Change the chart title |
| `update_live_chart_type` | Change the chart type |
| `move_live_chart` | Move a chart to a new position |
| `resize_live_chart` | Resize a chart (width/height in points) |
| `add_live_chart_series` | Add a new data series to an existing chart |
| `delete_live_chart_series` | Remove a data series from a chart |
| `get_live_chart_data` | Read chart series data and properties |
| `set_live_chart_axis_title` | Set the X or Y axis title |
| `set_live_chart_data_range` | Update the data range of a chart |
| `set_live_chart_legend` | Show, hide, or reposition the legend |

##### Pivot Tables

| Tool | Description |
|------|-------------|
| `create_live_pivot_table` | Create a PivotTable from a data range |
| `delete_live_pivot_table` | Delete a PivotTable |
| `list_live_pivot_tables` | List all PivotTables in a workbook |
| `refresh_live_pivot_tables` | Refresh all PivotTables |
| `refresh_live_single_pivot` | Refresh a specific PivotTable by name |
| `get_live_pivot_data` | Read PivotTable data and field configuration |

##### Conditional Formatting

| Tool | Description |
|------|-------------|
| `add_live_conditional_format` | Add a conditional formatting rule to a range |
| `clear_live_conditional_format` | Remove conditional formatting from a range |
| `get_live_conditional_formats` | List all conditional formatting rules on a sheet |

##### Data Validation

| Tool | Description |
|------|-------------|
| `add_live_data_validation` | Add a data validation rule (list, number, date, etc.) |
| `delete_live_data_validation` | Remove a data validation rule |
| `get_live_data_validation_info` | Read data validation settings on a range |
| `list_live_data_validations` | List all data validation rules on a sheet |

##### Comments & Hyperlinks

| Tool | Description |
|------|-------------|
| `add_live_comment` | Add a comment to a cell |
| `get_live_comments` | List all comments on a sheet |
| `delete_live_comment` | Delete a comment from a cell |
| `add_live_hyperlink` | Add a hyperlink to a cell |
| `get_live_hyperlinks` | List all hyperlinks on a sheet |
| `delete_live_hyperlink` | Remove a hyperlink from a cell |

##### Shapes, Images & Text Boxes

| Tool | Description |
|------|-------------|
| `add_live_shape` | Insert a shape (rectangle, ellipse, arrow, etc.) |
| `delete_live_shape` | Delete a shape by name |
| `list_live_shapes` | List all shapes on a sheet |
| `get_live_shape_info` | Get position, size, and type of a shape |
| `rename_live_shape` | Rename a shape |
| `set_live_shape_text` | Set the text inside a shape |
| `add_live_text_box` | Insert a text box at a given position |
| `add_live_image` | Insert an image from a file path |
| `delete_live_image` | Delete an image by name |
| `list_live_images` | List all images on a sheet |

##### Sparklines & Slicers

| Tool | Description |
|------|-------------|
| `add_live_sparkline` | Add a sparkline (line, column, win/loss) to a cell |
| `delete_live_sparkline` | Delete a sparkline |
| `add_live_slicer` | Add a slicer connected to a table or PivotTable |
| `delete_live_slicer` | Delete a slicer |
| `list_live_slicers` | List all slicers on a sheet |

##### Print & Page Setup

| Tool | Description |
|------|-------------|
| `set_live_print_area` | Define the print area for a sheet |
| `set_live_page_orientation` | Set portrait or landscape orientation |
| `set_live_paper_size` | Set paper size (A4, Letter, etc.) |
| `set_live_margins` | Set page margins (top, bottom, left, right in inches) |
| `set_live_header_footer` | Set header and footer text for printing |
| `get_live_page_setup` | Read all page setup settings |
| `set_live_print_scale` | Set the print scale percentage |
| `set_live_fit_to_page` | Fit sheet to a given number of pages wide/tall |
| `set_live_print_titles` | Set rows/columns to repeat on every printed page |
| `insert_live_page_break` | Insert a manual page break |
| `remove_live_page_break` | Remove a manual page break |
| `list_live_page_breaks` | List all manual page breaks on a sheet |
| `lock_live_cells` | Lock/unlock cells for sheet protection |

##### External Data

| Tool | Description |
|------|-------------|
| `refresh_live_external_data` | Refresh all external data connections |
| `list_live_external_connections` | List all external data connections |

***

### Project Structure

```
excel-mcp-server/
├── .actor/
│   ├── actor.json          ## Apify actor config + $0.001/call pricing
│   └── input_schema.json   ## Apify input schema
├── tools/
│   ├── local_excel.py      ## openpyxl-based local file tools
│   ├── m365_excel.py       ## Microsoft Graph API / M365 tools
│   └── live_excel.py       ## xlwings COM automation tools
├── server.py               ## FastMCP server — 219 tools
├── requirements.txt        ## Python dependencies
├── Dockerfile              ## Container build file
└── README.md
```

***

### Requirements

```
mcp
openpyxl
msal
requests
python-dotenv
pandas
xlwings
```

Install: `pip install -r requirements.txt`

> **Note:** `xlwings` (live Excel tools) requires **Microsoft Excel** installed on Windows or macOS. Live tools do not work in headless Linux/Docker environments. Local and M365 tools work on any platform.

***

### Apify Pricing

Published on Apify with **pay-per-use** pricing:

| Event | Price |
|-------|-------|
| 1 tool call | **$0.001 USD** |

Configured in `.actor/actor.json`:

```json
"monetization": {
  "pricingModel": "PER_USAGE_EVENT",
  "pricePerUnitUsd": 0.001,
  "usageEventTitle": "Tool call"
}
```

***

### Troubleshooting

**`xlwings` COM error: "Application not found"**

- Excel must be installed and licensed on the same Windows machine.
- Start Excel at least once before using live tools.

**`PermissionError` when saving `.xlsx`**

- The file is open in another process. Close it first, or use `save_excel_live`.

**M365 authentication fails**

- Check that `AZURE_CLIENT_ID` and `AZURE_TENANT_ID` are set in `.env`.
- Ensure the Azure App has `Files.ReadWrite.All` and `Sites.ReadWrite.All` permissions granted by an admin.
- Re-run `authenticate_m365` to refresh the token.

**Server not detected by MCP client**

- Verify the path in your MCP client config points to the correct `server.py`.
- Python 3.10+ is required.

# Actor input Schema

## `excel_file` (type: `string`):

Your .xlsx file encoded as a Base64 string. The file will be saved to the server's temp workspace and its path returned so you can use it with any local-Excel tool. You can encode with: python -c "import base64; print(base64.b64encode(open('file.xlsx','rb').read()).decode())"

## `excel_filename` (type: `string`):

Filename to save the uploaded Excel file as, e.g. 'my\_data.xlsx'. Only used when Excel File (Base64) is provided.

## `excel_file_url` (type: `string`):

Direct download URL for an .xlsx file (OneDrive share link, S3 pre-signed URL, Dropbox direct link, etc.). The file will be downloaded to the server's temp workspace.

## `create_new_workbook` (type: `boolean`):

Create a blank new workbook on startup. The path will be /tmp/excel\_mcp\_uploads/new\_workbook.xlsx.

## `tool_call` (type: `object`):

Optional tool to execute on startup. Specify the tool name and its arguments as JSON. The result will be saved to the actor's default dataset. Leave empty to run as a pure MCP SSE server.

## `transport` (type: `string`):

MCP transport protocol. SSE is required for Apify cloud deployments (connects via the actor's public URL). Use stdio only for local testing.

## `azure_client_id` (type: `string`):

Azure App Registration Client ID for Microsoft 365 / OneDrive tools. Leave empty if you only need local Excel tools.

## `azure_tenant_id` (type: `string`):

Azure Active Directory Tenant ID for Microsoft 365 authentication.

## `azure_client_secret` (type: `string`):

Azure App Registration client secret for Microsoft 365 / OneDrive tools.

## Actor input object example

```json
{
  "excel_file": "",
  "excel_filename": "workbook.xlsx",
  "excel_file_url": "",
  "create_new_workbook": false,
  "tool_call": {
    "name": "get_workbook_info",
    "arguments": {
      "file_path": "/tmp/excel_mcp_uploads/workbook.xlsx"
    }
  },
  "transport": "sse",
  "azure_client_id": "",
  "azure_tenant_id": ""
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("muhammadaashiq/excel-mcp-server").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("muhammadaashiq/excel-mcp-server").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call muhammadaashiq/excel-mcp-server --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=muhammadaashiq/excel-mcp-server",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Excel Mcp Server",
        "description": "Excel Mcp server with 200+ tools",
        "version": "0.0",
        "x-build-id": "RzlVNt2IdLXBU1tZv"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/muhammadaashiq~excel-mcp-server/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-muhammadaashiq-excel-mcp-server",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/muhammadaashiq~excel-mcp-server/runs": {
            "post": {
                "operationId": "runs-sync-muhammadaashiq-excel-mcp-server",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/muhammadaashiq~excel-mcp-server/run-sync": {
            "post": {
                "operationId": "run-sync-muhammadaashiq-excel-mcp-server",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "excel_file": {
                        "title": "Excel File (Base64)",
                        "type": "string",
                        "description": "Your .xlsx file encoded as a Base64 string. The file will be saved to the server's temp workspace and its path returned so you can use it with any local-Excel tool. You can encode with: python -c \"import base64; print(base64.b64encode(open('file.xlsx','rb').read()).decode())\"",
                        "default": ""
                    },
                    "excel_filename": {
                        "title": "Excel Filename",
                        "type": "string",
                        "description": "Filename to save the uploaded Excel file as, e.g. 'my_data.xlsx'. Only used when Excel File (Base64) is provided.",
                        "default": "workbook.xlsx"
                    },
                    "excel_file_url": {
                        "title": "Excel File URL",
                        "type": "string",
                        "description": "Direct download URL for an .xlsx file (OneDrive share link, S3 pre-signed URL, Dropbox direct link, etc.). The file will be downloaded to the server's temp workspace.",
                        "default": ""
                    },
                    "create_new_workbook": {
                        "title": "Create New Workbook",
                        "type": "boolean",
                        "description": "Create a blank new workbook on startup. The path will be /tmp/excel_mcp_uploads/new_workbook.xlsx.",
                        "default": false
                    },
                    "tool_call": {
                        "title": "Tool Call",
                        "type": "object",
                        "description": "Optional tool to execute on startup. Specify the tool name and its arguments as JSON. The result will be saved to the actor's default dataset. Leave empty to run as a pure MCP SSE server.",
                        "default": {
                            "name": "get_workbook_info",
                            "arguments": {
                                "file_path": "/tmp/excel_mcp_uploads/workbook.xlsx"
                            }
                        }
                    },
                    "transport": {
                        "title": "Transport",
                        "enum": [
                            "sse",
                            "stdio"
                        ],
                        "type": "string",
                        "description": "MCP transport protocol. SSE is required for Apify cloud deployments (connects via the actor's public URL). Use stdio only for local testing.",
                        "default": "sse"
                    },
                    "azure_client_id": {
                        "title": "Azure Client ID",
                        "type": "string",
                        "description": "Azure App Registration Client ID for Microsoft 365 / OneDrive tools. Leave empty if you only need local Excel tools.",
                        "default": ""
                    },
                    "azure_tenant_id": {
                        "title": "Azure Tenant ID",
                        "type": "string",
                        "description": "Azure Active Directory Tenant ID for Microsoft 365 authentication.",
                        "default": ""
                    },
                    "azure_client_secret": {
                        "title": "Azure Client Secret",
                        "type": "string",
                        "description": "Azure App Registration client secret for Microsoft 365 / OneDrive tools."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
