Feature Request: Excel Workbook MCP Tools for In-Place Editing (AI agent use)
- Dominant language
- C#
- Stars
- 3.7k
- Forks
- 624
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 220
Description
## Summary
Add MCP tool endpoints that expose the Microsoft Graph Excel REST API, enabling AI agents to read and write Excel workbooks hosted in SharePoint/OneDrive **in-place** — without downloading, modifying locally, and re-uploading.
## Problem Statement
The current SharePoint MCP tools (`readSmallBinaryFile`, `createSmallBinaryFile`, etc.) operate at the **file level** — download the whole file, edit locally, re-upload. This approach breaks down in practice because:
1. **OneDrive Files On-Demand** (Windows) replaces local files with OLE2 placeholder stubs. Local Python libraries (openpyxl, pandas) cannot read these — they get the 143KB placeholder instead of the real 9KB workbook content.
2. **Download → edit → re-upload risks breaking file links/IDs** that users have bookmarked, and can conflict with browser-based editing sessions.
3. **The Graph API already supports cell-level Excel operations** — the capability exists, it just isn't exposed as MCP tools.
## Use Case
I have an AI agent (built on GitHub Copilot CLI + MCP tools) that:
- Triages my email inbox every 2 hours
- Extracts action items into an Excel tracker hosted in SharePoint/OneDrive
- I edit the tracker in **Excel Online (browser)** — dismissing items, changing priorities, adding notes
- The agent reads my edits as learning signals for the next run
**Today this workflow is broken** because the agent cannot read or write the cloud-hosted Excel file. I've had to fall back to a local-only file, which loses the convenience of browser editing from any device.
## Proposed Tools
Based on the [Microsoft Graph Excel REST API](https://learn.microsoft.com/en-us/graph/api/resources/excel?view=graph-rest-1.0), the following MCP tool endpoints would unlock this scenario:
### Read Operations
| Tool Name | Graph Endpoint | Description |
|-----------|---------------|-------------|
| `excel-GetWorksheets` | `GET /workbook/worksheets` | List worksheets in a workbook |
| `excel-ReadRange` | `GET /workbook/worksheets/{id}/range(address='{range}')` | Read cell values from a range |
| `excel-ReadTable` | `GET /workbook/tables/{id}/rows` | Read structured table data |
| `excel-GetUsedRange` | `GET /workbook/worksheets/{id}/usedRange` | Get the used range (auto-detect data bounds) |
### Write Operations
| Tool Name | Graph Endpoint | Description |
|-----------|---------------|-------------|
| `excel-WriteRange` | `PATCH /workbook/worksheets/{id}/range(address='{range}')` | Write values to cells |
| `excel-AppendTableRow` | `POST /workbook/tables/{id}/rows` | Append rows to a structured table |
| `excel-UpdateTableRow` | `PATCH /workbook/tables/{id}/rows/itemAt(index={n})` | Update an existing table row |
### Formatting Operations
| Tool Name | Graph Endpoint | Description |
|-----------|---------------|-------------|
| `excel-SetRangeFormat` | `PATCH /workbook/worksheets/{id}/range/format` | Apply formatting (fill, font, borders) |
| `excel-AddConditionalFormat` | `POST /workbook/worksheets/{id}/range/conditionalFormats/add` | Add conditional formatting rules |
| `excel-CreateTable` | `POST /workbook/tables/add` | Create a structured table with headers |
### Session Management
| Tool Name | Graph Endpoint | Description |
|-----------|---------------|-------------|
| `excel-CreateSession` | `POST /workbook/createSession` | Create a persistent session for batch operations |
| `excel-CloseSession` | `POST /workbook/closeSession` | Close and save a session |
All tools would take `driveId` and `fileId` parameters (consistent with existing SharePoint MCP tools) and operate through the Graph API — no local file access needed.
## Why This Matters
Excel is the most common structured data format in enterprise environments. AI agents that can read and write Excel workbooks in SharePoint unlock scenarios like:
- **Automated reporting** — agents populate dashboards and trackers
- **Action item tracking** — agents extract tasks from emails/meetings and maintain shared trackers
- **Data pipelines** — agents process and transform data in workbooks that teams collaborate on
- **Approval workflows** — agents update status columns as approvals flow through
The Graph Excel API already supports all of this. Exposing it through MCP tools would make it accessible to any AI agent in the ecosystem.
## Additional Context
- The existing `sharepoint-readSmallBinaryFile` tool returns OneDrive placeholder stubs on Windows machines with Files On-Demand enabled, making the download approach unreliable even when the Graph API file metadata correctly reports the file as `.xlsx`.
- Excel Online sessions and local file edits can conflict — in-place API editing avoids this entirely.
- The Graph Excel API supports both persistent sessions (for batch operations) and sessionless calls (for quick reads/writes).
Contributor guide
Assessment
This issue has not been assessed yet.