Skip to main content
The Excel connector provides full access to Microsoft Excel workbooks via the Microsoft Graph API, enabling AI agents and automations to read, write, and manipulate spreadsheets stored in OneDrive or SharePoint.

Read & Write

Access cell values, formulas, and ranges with full formatting support

Tables & Charts

Create and manipulate Excel tables, charts, and pivot tables

Functions

Execute Excel functions and recalculate workbooks

Prerequisites

  • An Azure AD Application registered in your tenant
  • Application permissions granted:
    • Files.Read.All - Read-only access to files
    • Files.ReadWrite.All - Read/write access to files
    • Sites.Read.All or Sites.ReadWrite.All - For SharePoint-based files
  • Admin consent granted for these permissions

Installation

  1. Go to Apps in your workspace
  2. Search for Excel and install it
  3. Configure the app instance with your Azure AD credentials

Configuration

FieldValue
Azure Client IDApplication (client) ID from Azure AD
Azure Client SecretClient secret value
Azure Tenant IDDirectory (tenant) ID
SharePoint Site IDOptional, for SharePoint-hosted files

File Access

OneDrive files - provide only itemId:
- Excel.getRange:
    itemId: "01ABCDEF..."
    worksheetId: Sheet1
    address: "A1:C10"
    output: data
SharePoint files - provide itemId and siteId:
- Excel.getRange:
    itemId: "01ABCDEF..."
    siteId: "contoso.sharepoint.com,abc-123,def-456"
    worksheetId: Sheet1
    address: "A1:C10"
    output: data

Available Automations

Workbook Operations

AutomationDescription
createWorkbookCreate a new Excel workbook
calculateWorkbookRecalculate all formulas

Worksheet Operations

AutomationDescription
listWorksheetsList all worksheets
getWorksheetGet worksheet details
addWorksheetCreate new worksheet
updateWorksheetRename or reposition
deleteWorksheetDelete worksheet
getUsedRangeGet data-containing range

Range Operations

AutomationDescription
getRangeRead cell values and formulas
updateRangeWrite values to cells
getCellRead a single cell
clearRangeClear contents or formatting
insertRangeInsert cells with shift
deleteRangeDelete cells with shift
sortRangeSort range data
mergeRangeMerge cells
unmergeRangeUnmerge cells

Formatting

AutomationDescription
updateFormatSet alignment and wrapping
updateFontSet font properties
updateFillSet background color
updateBorderSet border styles
autofitColumnsAuto-fit column widths
autofitRowsAuto-fit row heights

Tables

AutomationDescription
listTablesList tables in workbook
getTableGet table details
createTableCreate table from range
updateTableUpdate table properties
deleteTableDelete table
addTableRowAdd row to table
updateTableRowUpdate row values
deleteTableRowDelete row
addTableColumnAdd column
deleteTableColumnDelete column
applyTableSortSort table
applyTableFilterFilter table
clearTableFilterClear filters
convertTableToRangeConvert to normal range

Charts

AutomationDescription
listChartsList charts in worksheet
getChartGet chart details
addChartCreate chart
updateChartUpdate properties
deleteChartDelete chart
setChartDataChange data source
setChartPositionPosition chart
getChartImageExport as image
updateChartTitleSet title
updateChartLegendConfigure legend

Named Items & Pivot Tables

AutomationDescription
listNamedItemsList named ranges
getNamedItemGet named item value
addNamedItemCreate named range
updateNamedItemUpdate named item
listPivotTablesList pivot tables
getPivotTableGet pivot table details
refreshPivotTableRefresh pivot table
refreshAllPivotTablesRefresh all

Functions

AutomationDescription
executeExcelFunctionExecute Excel function

DSUL Examples

Read a Range

- Excel.getRange:
    itemId: "01ABCDEF..."
    worksheetId: Sheet1
    address: "A1:C10"
    output: data

Write Values

- Excel.updateRange:
    itemId: "01ABCDEF..."
    worksheetId: Sheet1
    address: "A1:C2"
    values:
      - ["Name", "Age", "City"]
      - ["John", 30, "New York"]
    output: result

Create a Table

- Excel.createTable:
    itemId: "01ABCDEF..."
    worksheetId: Sheet1
    address: "A1:C10"
    hasHeaders: true
    output: table

Error Handling

HTTP StatusErrorSolution
401UnauthorizedReconfigure credentials
403ForbiddenCheck app permissions
404Not FoundVerify item ID exists
423LockedClose file in Office app
429Rate LimitedWait and retry

Common Issues

“File is locked” - The Excel file is open in the desktop application. Close it or wait for auto-save. “Invalid range address” - Use A1 notation (e.g., “A1:C10”, not row/column numbers). “Range too large” - Excel API limits requests to 5 million cells. Split into smaller ranges. “.xls not supported” - Only .xlsx files are supported. Convert legacy files first.

Rate Limits

LimitValue
Per-app (all tenants)5,000 requests/10 seconds
Per-app per-tenant1,500 requests/10 seconds
Max cells per request5,000,000
Max file size25 MB
When rate limited, the API returns HTTP 429 with a Retry-After header.

External Resources

Microsoft Graph Excel API

Official API documentation

Excel API Best Practices

Performance optimization tips

Graph Explorer

Test API calls interactively

MCP Specification

Model Context Protocol specification