简介
通过托管OAuth安全连接Microsoft Excel API,支持读写OneDrive/SharePoint中的工作簿、工作表、单元格范围、表格及图表数据。
原始描述
Microsoft Excel API integration with managed OAuth. Read and write Excel workbooks, worksheets, ranges, tables, and charts stored in OneDrive. Use this skill...
通过你的 Agent 添加
安装目录:microsoft-excel/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
中文使用说明 来自收录源
核心用法
Microsoft Excel技能提供对Microsoft Graph Excel API的完整访问能力,通过Maton托管OAuth网关实现安全认证。核心功能涵盖:
数据操作:读取/写入单元格范围(A1notation)、获取已用区域、批量更新数据、清除格式或内容 工作表管理:创建、重命名、删除工作表,调整工作表顺序 表格处理:将数据范围转换为Excel表格(Table),动态添加行列,管理表头与汇总行 图表集成:在工作表中添加ClusteredColumn等图表类型 文件管理:通过OneDrive路径或文件ID访问工作簿,支持上传.xlsx文件 性能优化:使用持久化会话(Session)批量执行操作,减少认证开销
典型调用模式为https://gateway.maton.ai/microsoft-excel/{native-api-path},自动注入OAuth令牌。
显著优点
- 企业级生态整合:原生支持OneDrive/SharePoint存储,与Microsoft 365无缝协作
- 托管OAuth安全:Maton集中管理令牌生命周期,无需开发者处理OAuth流程
- 完整API覆盖:涵盖Range、Worksheet、Table、Chart、NamedItem等全部Excel REST API能力
- 灵活寻址:同时支持文件路径(
root:/path/file.xlsx)和文件ID两种访问模式
- 会话机制:持久化会话支持批量原子操作,非持久会话适合只读查询
潜在局限
- 格式限制:仅支持.xlsx格式,不兼容遗留.xls文件
- URL编码要求:工作表名含特殊字符、ID中的
{ }需手动编码
- 会话超时:持久会话约5分钟空闲过期,非持久约7分钟,长任务需管理续期
- Shell环境敏感:curl命令含括号时需
-g禁用glob,管道环境变量可能不展开
- 依赖Maton平台:API密钥与连接管理绑定Maton服务,存在供应商锁定风险
适合人群
- 数据分析师:需要自动化Excel报表生成、数据清洗与分发
- 企业系统集成者:将Excel作为数据交换枢纽,对接ERP/CRM系统
- 财务/运营团队:批量处理预算表、统计表,自动化图表更新
- 低代码开发者:通过REST API替代VBA宏,实现跨平台Excel操作
常规风险
风险类型
说明
缓解建议
OAuth令牌泄露
Maton平台遭入侵可能导致Microsoft账户访问权限泄露
定期审查连接状态,及时删除闲置连接
数据覆盖
PATCH操作可能意外覆盖公式、格式或他人数据
操作前获取usedRange备份,使用null值选择性更新
并发冲突
多会话同时修改同一工作簿可能导致数据不一致
使用持久会话并设置persistChanges: true确保写入顺序
API限流
Microsoft Graph存在调用配额限制
实现429状态码重试逻辑,批量操作优先使用会话模式
权限漂移
OAuth授权后用户修改OneDrive权限可能导致API调用失败
连接状态监控,异常时重新授权
安全建议
- API密钥存储于环境变量,禁止硬编码或提交至版本控制
- 生产环境使用专用Maton连接,避免开发/测试连接混用
- 敏感数据工作簿建议配置SharePoint权限审计日志
- 定期执行
DELETE清理过期会话,减少攻击面
root:/path/file.xlsx)和文件ID两种访问模式- 格式限制:仅支持.xlsx格式,不兼容遗留.xls文件
- URL编码要求:工作表名含特殊字符、ID中的
{}需手动编码 - 会话超时:持久会话约5分钟空闲过期,非持久约7分钟,长任务需管理续期
- Shell环境敏感:curl命令含括号时需
-g禁用glob,管道环境变量可能不展开 - 依赖Maton平台:API密钥与连接管理绑定Maton服务,存在供应商锁定风险
适合人群
- 数据分析师:需要自动化Excel报表生成、数据清洗与分发
- 企业系统集成者:将Excel作为数据交换枢纽,对接ERP/CRM系统
- 财务/运营团队:批量处理预算表、统计表,自动化图表更新
- 低代码开发者:通过REST API替代VBA宏,实现跨平台Excel操作
常规风险
风险类型
说明
缓解建议
OAuth令牌泄露
Maton平台遭入侵可能导致Microsoft账户访问权限泄露
定期审查连接状态,及时删除闲置连接
数据覆盖
PATCH操作可能意外覆盖公式、格式或他人数据
操作前获取usedRange备份,使用null值选择性更新
并发冲突
多会话同时修改同一工作簿可能导致数据不一致
使用持久会话并设置persistChanges: true确保写入顺序
API限流
Microsoft Graph存在调用配额限制
实现429状态码重试逻辑,批量操作优先使用会话模式
权限漂移
OAuth授权后用户修改OneDrive权限可能导致API调用失败
连接状态监控,异常时重新授权
安全建议
- API密钥存储于环境变量,禁止硬编码或提交至版本控制
- 生产环境使用专用Maton连接,避免开发/测试连接混用
- 敏感数据工作簿建议配置SharePoint权限审计日志
- 定期执行
DELETE清理过期会话,减少攻击面
| 风险类型 | 说明 | 缓解建议 |
|---|---|---|
| OAuth令牌泄露 | Maton平台遭入侵可能导致Microsoft账户访问权限泄露 | 定期审查连接状态,及时删除闲置连接 |
| 数据覆盖 | PATCH操作可能意外覆盖公式、格式或他人数据 | 操作前获取usedRange备份,使用null值选择性更新 |
| 并发冲突 | 多会话同时修改同一工作簿可能导致数据不一致 | 使用持久会话并设置persistChanges: true确保写入顺序 |
| API限流 | Microsoft Graph存在调用配额限制 | 实现429状态码重试逻辑,批量操作优先使用会话模式 |
| 权限漂移 | OAuth授权后用户修改OneDrive权限可能导致API调用失败 | 连接状态监控,异常时重新授权 |
安全建议
- API密钥存储于环境变量,禁止硬编码或提交至版本控制
- 生产环境使用专用Maton连接,避免开发/测试连接混用
- 敏感数据工作簿建议配置SharePoint权限审计日志
- 定期执行
DELETE清理过期会话,减少攻击面
DELETE清理过期会话,减少攻击面技能正文
name: microsoft-excel
description: |
Microsoft Excel API integration with managed OAuth. Read and write Excel workbooks, worksheets, ranges, tables, and charts stored in OneDrive.
Use this skill when users want to read or modify Excel spreadsheets, manage worksheet data, work with tables, or access cell values.
For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway).
compatibility: Requires network access and valid Maton API key
metadata:
author: maton
version: "1.0"
clawdbot:
emoji: 🧠
requires:
env:
- MATON_API_KEY
Microsoft Excel
Access the Microsoft Excel API (via Microsoft Graph) with managed OAuth authentication. Read and write workbooks, worksheets, ranges, tables, and charts stored in OneDrive or SharePoint.
Quick Start
# List worksheets in a workbook
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
Base URL
https://gateway.maton.ai/microsoft-excel/{native-api-path}
# List worksheets in a workbook
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
https://gateway.maton.ai/microsoft-excel/{native-api-path}
Replace {native-api-path} with the actual Microsoft Graph API endpoint path. The gateway proxies requests to graph.microsoft.com and automatically injects your OAuth token.
Authentication
All requests require the Maton API key in the Authorization header:
Authorization: Bearer $MATON_API_KEY
Environment Variable: Set your API key as MATON_API_KEY:
export MATON_API_KEY="YOUR_API_KEY"
Getting Your API Key
- Sign in or create an account at maton.ai
- Go to maton.ai/settings
- Copy your API key
Connection Management
Manage your Microsoft Excel OAuth connections at https://ctrl.maton.ai.
List Connections
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections?app=microsoft-excel&status=ACTIVE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
Create Connection
python <<'EOF'
import urllib.request, os, json
data = json.dumps({'app': 'microsoft-excel'}).encode()
req = urllib.request.Request('https://ctrl.maton.ai/connections', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
Get Connection
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections?app=microsoft-excel&status=ACTIVE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
python <<'EOF'
import urllib.request, os, json
data = json.dumps({'app': 'microsoft-excel'}).encode()
req = urllib.request.Request('https://ctrl.maton.ai/connections', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
Get Connection
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
Response:
{
"connection": {
"connection_id": "4751ac89-3970-47e1-872c-eacdf4291732",
"status": "ACTIVE",
"creation_time": "2026-02-07T00:43:18.565932Z",
"last_updated_time": "2026-02-07T00:43:29.729782Z",
"url": "https://connect.maton.ai/?session_token=...",
"app": "microsoft-excel",
"metadata": {}
}
}
Open the returned url in a browser to complete OAuth authorization.
Delete Connection
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}', method='DELETE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
Specifying Connection
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}', method='DELETE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
If you have multiple Microsoft Excel connections, specify which one to use with the Maton-Connection header:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/microsoft-excel/v1.0/me/drive')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Maton-Connection', '4751ac89-3970-47e1-872c-eacdf4291732')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
If omitted, the gateway uses the default (oldest) active connection.
Workbook Access Patterns
You can access workbooks using either ID-based or path-based patterns:
By File ID:
/microsoft-excel/v1.0/me/drive/items/{file-id}/workbook/...
By File Path:
/microsoft-excel/v1.0/me/drive/root:/{path-to-file}:/workbook/...
API Reference
Drive Operations
Get Drive Info
GET /microsoft-excel/v1.0/me/drive
List Root Files
GET /microsoft-excel/v1.0/me/drive/root/children
Search for Excel Files
GET /microsoft-excel/v1.0/me/drive/root/search(q='.xlsx')
Upload Excel File
PUT /microsoft-excel/v1.0/me/drive/root:/{filename}.xlsx:/content
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
{binary xlsx content}
Session Management
GET /microsoft-excel/v1.0/me/drive
GET /microsoft-excel/v1.0/me/drive/root/children
Search for Excel Files
GET /microsoft-excel/v1.0/me/drive/root/search(q='.xlsx')
Upload Excel File
PUT /microsoft-excel/v1.0/me/drive/root:/{filename}.xlsx:/content
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
{binary xlsx content}
Session Management
GET /microsoft-excel/v1.0/me/drive/root/search(q='.xlsx')
PUT /microsoft-excel/v1.0/me/drive/root:/{filename}.xlsx:/content
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
{binary xlsx content}
Session Management
Sessions improve performance for multiple operations. Recommended for batch operations.
Create Session
POST /microsoft-excel/v1.0/me/drive/root:/{path}:/workbook/createSession
Content-Type: application/json
{
"persistChanges": true
}
POST /microsoft-excel/v1.0/me/drive/root:/{path}:/workbook/createSession
Content-Type: application/json
{
"persistChanges": true
}
Response:
{
"persistChanges": true,
"id": "cluster=PUS7&session=..."
}
Use the session ID in subsequent requests:
workbook-session-id: {session-id}
Close Session
POST /microsoft-excel/v1.0/me/drive/root:/{path}:/workbook/closeSession
workbook-session-id: {session-id}
Worksheet Operations
List Worksheets
GET /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets
POST /microsoft-excel/v1.0/me/drive/root:/{path}:/workbook/closeSession
workbook-session-id: {session-id}
List Worksheets
GET /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets
Response:
{
"value": [
{
"id": "{00000000-0001-0000-0000-000000000000}",
"name": "Sheet1",
"position": 0,
"visibility": "Visible"
}
]
}
Get Worksheet
GET /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets('Sheet1')
Create Worksheet
POST /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets
Content-Type: application/json
{
"name": "NewSheet"
}
Update Worksheet
PATCH /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets('Sheet1')
Content-Type: application/json
{
"name": "RenamedSheet",
"position": 2
}
Delete Worksheet
DELETE /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets('{worksheet-id}')
GET /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets('Sheet1')
POST /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets
Content-Type: application/json
{
"name": "NewSheet"
}
Update Worksheet
PATCH /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets('Sheet1')
Content-Type: application/json
{
"name": "RenamedSheet",
"position": 2
}
Delete Worksheet
DELETE /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets('{worksheet-id}')
PATCH /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets('Sheet1')
Content-Type: application/json
{
"name": "RenamedSheet",
"position": 2
}
DELETE /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets('{worksheet-id}')
Returns 204 No Content on success.
Range Operations
Get Range
GET /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets('Sheet1')/range(address='A1:B2')
Response:
{
"address": "Sheet1!A1:B2",
"values": [
["Hello", "World"],
[1, 2]
],
"formulas": [
["Hello", "World"],
[1, 2]
],
"text": [
["Hello", "World"],
["1", "2"]
],
"numberFormat": [
["General", "General"],
["General", "General"]
],
"rowCount": 2,
"columnCount": 2
}
Get Used Range
GET /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets('Sheet1')/usedRange
Update Range
PATCH /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets('Sheet1')/range(address='A1:B2')
Content-Type: application/json
{
"values": [
["Updated", "Values"],
[100, 200]
]
}
Clear Range
POST /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets('Sheet1')/range(address='A1:B2')/clear
Content-Type: application/json
{
"applyTo": "All"
}
GET /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets('Sheet1')/usedRange
PATCH /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets('Sheet1')/range(address='A1:B2')
Content-Type: application/json
{
"values": [
["Updated", "Values"],
[100, 200]
]
}
Clear Range
POST /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets('Sheet1')/range(address='A1:B2')/clear
Content-Type: application/json
{
"applyTo": "All"
}
POST /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets('Sheet1')/range(address='A1:B2')/clear
Content-Type: application/json
{
"applyTo": "All"
}
Options: All, Formats, Contents
Table Operations
List Tables
GET /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets('Sheet1')/tables
Create Table from Range
POST /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets('Sheet1')/tables/add
Content-Type: application/json
{
"address": "A1:C4",
"hasHeaders": true
}
POST /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets('Sheet1')/tables/add
Content-Type: application/json
{
"address": "A1:C4",
"hasHeaders": true
}
Response:
{
"id": "{6D182180-5F5F-448B-9E9C-377A5251CFC5}",
"name": "Table1",
"showHeaders": true,
"showTotals": false,
"style": "TableStyleMedium2"
}
Get Table
GET /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/tables('Table1')
Update Table
PATCH /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/tables('Table1')
Content-Type: application/json
{
"name": "PeopleTable",
"showTotals": true
}
Get Table Rows
GET /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/tables('Table1')/rows
GET /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/tables('Table1')
PATCH /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/tables('Table1')
Content-Type: application/json
{
"name": "PeopleTable",
"showTotals": true
}
Get Table Rows
GET /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/tables('Table1')/rows
GET /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/tables('Table1')/rows
Response:
{
"value": [
{
"index": 0,
"values": [["Alice", 30, "NYC"]]
},
{
"index": 1,
"values": [["Bob", 25, "LA"]]
}
]
}
Add Table Row
POST /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/tables('Table1')/rows
Content-Type: application/json
{
"values": [["Carol", 35, "Chicago"]]
}
Delete Table Row
DELETE /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/tables('Table1')/rows/itemAt(index=0)
POST /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/tables('Table1')/rows
Content-Type: application/json
{
"values": [["Carol", 35, "Chicago"]]
}
DELETE /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/tables('Table1')/rows/itemAt(index=0)
Returns 204 No Content on success.
Get Table Columns
GET /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/tables('Table1')/columns
Add Table Column
POST /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/tables('Table1')/columns
Content-Type: application/json
{
"values": [["Email"], ["alice@example.com"], ["bob@example.com"]]
}
Named Items
List Named Items
GET /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/names
Charts
List Charts
GET /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets('Sheet1')/charts
Add Chart
POST /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets('Sheet1')/charts/add
Content-Type: application/json
{
"type": "ColumnClustered",
"sourceData": "A1:C4",
"seriesBy": "Auto"
}
Code Examples
JavaScript
// Get range values
const response = await fetch(
"https://gateway.maton.ai/microsoft-excel/v1.0/me/drive/root:/data.xlsx:/workbook/worksheets('Sheet1')/range(address='A1:B10')",
{
headers: {
'Authorization': `Bearer ${process.env.MATON_API_KEY}`
}
}
);
const data = await response.json();
console.log(data.values);
Python
import os
import requests
# Update range values
response = requests.patch(
"https://gateway.maton.ai/microsoft-excel/v1.0/me/drive/root:/data.xlsx:/workbook/worksheets('Sheet1')/range(address='A1:B2')",
headers={"Authorization": f"Bearer {os.environ['MATON_API_KEY']}"},
json={"values": [["Name", "Age"], ["Alice", 30]]},
)
print(response.json())
Notes
- Only
.xlsx files are supported (not legacy .xls)
- Worksheet names with special characters need URL encoding
- Table and worksheet IDs containing
{ and } must be URL-encoded (%7B and %7D)
- Sessions expire after ~5 minutes of inactivity (persistent) or ~7 minutes (non-persistent)
- Use
null in value arrays to skip updating specific cells
- Blank cells should use
"" (empty string)
- Range addresses use A1 notation (e.g.,
A1:C10, Sheet1!A1:B5)
- IMPORTANT: When using curl commands, use
curl -g when URLs contain parentheses to disable glob parsing
- IMPORTANT: When piping curl output to
jq or other commands, environment variables like $MATON_API_KEY may not expand correctly in some shell environments
Error Handling
Status
Meaning
400
Missing Microsoft Excel connection or invalid request
401
Invalid or missing Maton API key
404
Item not found or session expired
429
Rate limited
4xx/5xx
Passthrough error from Microsoft Graph API
Common Error Codes
Code
Description
ItemNotFound
File or resource doesn't exist
ItemAlreadyExists
Worksheet or table with that name already exists
InvalidArgument
Invalid parameter or missing required field
SessionNotFound
Session expired or doesn't exist
Troubleshooting: API Key Issues
- Check that the
MATON_API_KEY environment variable is set:
echo $MATON_API_KEY
- Verify the API key is valid by listing connections:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
Troubleshooting: Invalid App Name
- Ensure your URL path starts with
microsoft-excel. For example:
- Correct:
https://gateway.maton.ai/microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets
- Incorrect:
https://gateway.maton.ai/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets
Resources
GET /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/tables('Table1')/columns
POST /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/tables('Table1')/columns
Content-Type: application/json
{
"values": [["Email"], ["alice@example.com"], ["bob@example.com"]]
}
Named Items
List Named Items
GET /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/names
Charts
List Charts
GET /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets('Sheet1')/charts
Add Chart
POST /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets('Sheet1')/charts/add
Content-Type: application/json
{
"type": "ColumnClustered",
"sourceData": "A1:C4",
"seriesBy": "Auto"
}
Code Examples
JavaScript
// Get range values
const response = await fetch(
"https://gateway.maton.ai/microsoft-excel/v1.0/me/drive/root:/data.xlsx:/workbook/worksheets('Sheet1')/range(address='A1:B10')",
{
headers: {
'Authorization': `Bearer ${process.env.MATON_API_KEY}`
}
}
);
const data = await response.json();
console.log(data.values);
Python
import os
import requests
# Update range values
response = requests.patch(
"https://gateway.maton.ai/microsoft-excel/v1.0/me/drive/root:/data.xlsx:/workbook/worksheets('Sheet1')/range(address='A1:B2')",
headers={"Authorization": f"Bearer {os.environ['MATON_API_KEY']}"},
json={"values": [["Name", "Age"], ["Alice", 30]]},
)
print(response.json())
Notes
- Only
.xlsx files are supported (not legacy .xls)
- Worksheet names with special characters need URL encoding
- Table and worksheet IDs containing
{ and } must be URL-encoded (%7B and %7D)
- Sessions expire after ~5 minutes of inactivity (persistent) or ~7 minutes (non-persistent)
- Use
null in value arrays to skip updating specific cells
- Blank cells should use
"" (empty string)
- Range addresses use A1 notation (e.g.,
A1:C10, Sheet1!A1:B5)
- IMPORTANT: When using curl commands, use
curl -g when URLs contain parentheses to disable glob parsing
- IMPORTANT: When piping curl output to
jq or other commands, environment variables like $MATON_API_KEY may not expand correctly in some shell environments
Error Handling
Status
Meaning
400
Missing Microsoft Excel connection or invalid request
401
Invalid or missing Maton API key
404
Item not found or session expired
429
Rate limited
4xx/5xx
Passthrough error from Microsoft Graph API
Common Error Codes
Code
Description
ItemNotFound
File or resource doesn't exist
ItemAlreadyExists
Worksheet or table with that name already exists
InvalidArgument
Invalid parameter or missing required field
SessionNotFound
Session expired or doesn't exist
Troubleshooting: API Key Issues
- Check that the
MATON_API_KEY environment variable is set:
echo $MATON_API_KEY
- Verify the API key is valid by listing connections:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
Troubleshooting: Invalid App Name
- Ensure your URL path starts with
microsoft-excel. For example:
- Correct:
https://gateway.maton.ai/microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets
- Incorrect:
https://gateway.maton.ai/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets
Resources
POST /microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets('Sheet1')/charts/add
Content-Type: application/json
{
"type": "ColumnClustered",
"sourceData": "A1:C4",
"seriesBy": "Auto"
}
JavaScript
// Get range values
const response = await fetch(
"https://gateway.maton.ai/microsoft-excel/v1.0/me/drive/root:/data.xlsx:/workbook/worksheets('Sheet1')/range(address='A1:B10')",
{
headers: {
'Authorization': `Bearer ${process.env.MATON_API_KEY}`
}
}
);
const data = await response.json();
console.log(data.values);
import os
import requests
# Update range values
response = requests.patch(
"https://gateway.maton.ai/microsoft-excel/v1.0/me/drive/root:/data.xlsx:/workbook/worksheets('Sheet1')/range(address='A1:B2')",
headers={"Authorization": f"Bearer {os.environ['MATON_API_KEY']}"},
json={"values": [["Name", "Age"], ["Alice", 30]]},
)
print(response.json())
Notes
- Only
.xlsx files are supported (not legacy .xls)
- Worksheet names with special characters need URL encoding
- Table and worksheet IDs containing
{ and } must be URL-encoded (%7B and %7D)
- Sessions expire after ~5 minutes of inactivity (persistent) or ~7 minutes (non-persistent)
- Use
null in value arrays to skip updating specific cells
- Blank cells should use
"" (empty string)
- Range addresses use A1 notation (e.g.,
A1:C10, Sheet1!A1:B5)
- IMPORTANT: When using curl commands, use
curl -g when URLs contain parentheses to disable glob parsing
- IMPORTANT: When piping curl output to
jq or other commands, environment variables like $MATON_API_KEY may not expand correctly in some shell environments
Error Handling
Status
Meaning
400
Missing Microsoft Excel connection or invalid request
401
Invalid or missing Maton API key
404
Item not found or session expired
429
Rate limited
4xx/5xx
Passthrough error from Microsoft Graph API
Common Error Codes
Code
Description
ItemNotFound
File or resource doesn't exist
ItemAlreadyExists
Worksheet or table with that name already exists
InvalidArgument
Invalid parameter or missing required field
SessionNotFound
Session expired or doesn't exist
Troubleshooting: API Key Issues
.xlsx files are supported (not legacy .xls){ and } must be URL-encoded (%7B and %7D)null in value arrays to skip updating specific cells"" (empty string)A1:C10, Sheet1!A1:B5)curl -g when URLs contain parentheses to disable glob parsingjq or other commands, environment variables like $MATON_API_KEY may not expand correctly in some shell environments| Status | Meaning |
|---|---|
| 400 | Missing Microsoft Excel connection or invalid request |
| 401 | Invalid or missing Maton API key |
| 404 | Item not found or session expired |
| 429 | Rate limited |
| 4xx/5xx | Passthrough error from Microsoft Graph API |
Common Error Codes
| Code | Description |
|---|---|
ItemNotFound |
File or resource doesn't exist |
ItemAlreadyExists |
Worksheet or table with that name already exists |
InvalidArgument |
Invalid parameter or missing required field |
SessionNotFound |
Session expired or doesn't exist |
- Check that the
MATON_API_KEYenvironment variable is set:
echo $MATON_API_KEY
- Verify the API key is valid by listing connections:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
Troubleshooting: Invalid App Name
- Ensure your URL path starts with
microsoft-excel. For example:
- Correct:
https://gateway.maton.ai/microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets
- Incorrect:
https://gateway.maton.ai/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets
Resources
microsoft-excel. For example:https://gateway.maton.ai/microsoft-excel/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheetshttps://gateway.maton.ai/v1.0/me/drive/root:/workbook.xlsx:/workbook/worksheets