To connect Microsoft Excel to OpenClaw, register an application in Azure Active Directory to get MICROSOFT_CLIENT_ID and MICROSOFT_CLIENT_SECRET, then configure OpenClaw to call the Microsoft Graph API for reading and writing Excel workbooks stored in OneDrive or SharePoint. This is a Direct API Integration using the Graph API's Workbook endpoint. Once configured, OpenClaw can read and write Excel rows, update named ranges, create worksheets, and work with Excel files shared across your Microsoft 365 organization.
Why Connect Microsoft Excel to OpenClaw via Graph API?
Microsoft Excel remains the dominant spreadsheet tool in enterprise environments. While Google Sheets has grown in popularity, most large organizations — particularly in finance, legal, healthcare, and traditional industries — store critical data in Excel files on OneDrive or SharePoint. If your team uses Microsoft 365, Excel is likely where your reporting templates, financial models, and shared data tables live.
Connecting OpenClaw to Excel via the Microsoft Graph API gives your AI agent read and write access to these workbooks without requiring anyone to manually export or copy data. OpenClaw can append research findings to an Excel log, update a status tracker, read a lookup table of values for use in workflows, or write extracted data into a structured template. Because the Graph API works on OneDrive and SharePoint files, changes are immediately visible to colleagues with access to the workbook — just like real-time co-editing.
The authentication approach uses Azure AD application credentials (client ID and secret), which is the Microsoft equivalent of Google's service account approach. You register an app in Azure Active Directory, grant it Sites.ReadWrite.All or Files.ReadWrite.All permissions, and configure OpenClaw with the resulting client ID and secret. This is a non-interactive credential — no browser sign-in, no token refresh dialogs, just persistent machine-to-machine access. The setup takes about 30 minutes the first time but requires no ongoing maintenance unless you rotate the client secret.
Integration method
Microsoft Excel files stored in OneDrive or SharePoint are accessible through the Microsoft Graph API's Workbook endpoints. OpenClaw authenticates using client credentials flow (MICROSOFT_CLIENT_ID and MICROSOFT_CLIENT_SECRET) with an Azure AD app registration. Once authenticated, OpenClaw can read cell values, append rows, update worksheets, and manage named ranges in any Excel workbook the registered app has access to. This is a server-to-server auth flow — no user sign-in required after initial setup.
Prerequisites
- A Microsoft 365 account with access to Azure Active Directory (admin access or permission to register applications)
- Excel workbooks stored in OneDrive or SharePoint (local Excel files are not accessible via Graph API)
- OpenClaw installed on your machine with internet access
- The OneDrive or SharePoint path or item ID of the Excel workbook you want to access
- Basic familiarity with Azure Portal (portal.azure.com) for app registration
Step-by-step guide
Register an Application in Azure Active Directory
Register an Application in Azure Active Directory
The Microsoft Graph API requires an Azure AD application registration to authenticate programmatic access. This is Microsoft's equivalent of creating a Google service account — the app registration gives you a client ID and secret that OpenClaw uses to request access tokens. Steps to register the app: 1. Go to portal.azure.com and sign in with your Microsoft 365 account. 2. Navigate to 'Azure Active Directory' > 'App registrations' > 'New registration'. 3. Name the app (e.g., 'OpenClaw Excel Integration'), select 'Accounts in this organizational directory only' as the supported account type, and click 'Register'. 4. On the app's overview page, copy the 'Application (client) ID' — this is your MICROSOFT_CLIENT_ID. 5. Go to 'Certificates & secrets' > 'New client secret'. Add a description, set an expiry (24 months is reasonable), and click 'Add'. Copy the secret value immediately — it is only shown once. This is your MICROSOFT_CLIENT_SECRET. 6. Go to 'API permissions' > 'Add a permission' > 'Microsoft Graph' > 'Application permissions'. Add `Files.ReadWrite.All` (for OneDrive files) or `Sites.ReadWrite.All` (for SharePoint sites). Click 'Grant admin consent' to activate the permissions. Store the client ID and secret securely — treat the client secret as a password.
1# Azure AD app registration details to note:2# Application (client) ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx (MICROSOFT_CLIENT_ID)3# Client secret value: xxxxxxxxxxxxxxxxxxxxxxxx (MICROSOFT_CLIENT_SECRET)4# Directory (tenant) ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx (MICROSOFT_TENANT_ID)5# All three are shown on the app registration Overview page in Azure Portal67# Test that credentials work — get an access token:8curl -X POST \9 'https://login.microsoftonline.com/YOUR_TENANT_ID/oauth2/v2.0/token' \10 -H 'Content-Type: application/x-www-form-urlencoded' \11 -d 'client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET&scope=https://graph.microsoft.com/.default&grant_type=client_credentials'12# Success: returns JSON with 'access_token' and 'expires_in'Pro tip: Set a calendar reminder 2 weeks before your client secret expires. Expired secrets cause all OpenClaw Excel operations to fail with 401 errors. Rotate the secret in Azure Portal and update OpenClaw's config before the expiry date.
Expected result: The app registration is created in Azure AD, you have the client ID and secret, the Graph API permissions are granted and admin-consented, and the test token request returns a valid access token.
Configure MICROSOFT_CLIENT_ID and MICROSOFT_CLIENT_SECRET in OpenClaw
Configure MICROSOFT_CLIENT_ID and MICROSOFT_CLIENT_SECRET in OpenClaw
Open `~/.openclaw/config.yaml` and add the Microsoft Excel integration under `integrations`. The three required credentials are the tenant ID, client ID, and client secret — all from the Azure AD app registration in Step 1. The `tenant_id` is your organization's Azure AD tenant identifier — found on the app registration Overview page as 'Directory (tenant) ID'. It is a UUID in the format `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`. The `workbook_path` field is the path to your Excel file within OneDrive or SharePoint. For personal OneDrive, the path starts with `/me/drive/root:/path/to/file.xlsx`. For SharePoint, it starts with `/sites/SITE_NAME/drive/root:/path`. You can also specify the workbook by its Drive Item ID if you know it. OpenClaw handles token acquisition and refresh automatically — the client credentials are exchanged for a short-lived access token (valid 1 hour), and OpenClaw refreshes it transparently before expiry.
1# ~/.openclaw/config.yaml2integrations:3 microsoft-excel:4 tenant_id: "YOUR_TENANT_ID" # Azure AD tenant ID5 client_id: "YOUR_CLIENT_ID" # MICROSOFT_CLIENT_ID6 client_secret: "YOUR_CLIENT_SECRET" # MICROSOFT_CLIENT_SECRET7 # OneDrive workbook path:8 default_workbook: "/me/drive/root:/Documents/MyWorkbook.xlsx"9 # OR SharePoint:10 # default_workbook: "/sites/TeamSite/drive/root:/Shared Documents/Report.xlsx"11 default_worksheet: "Sheet1" # default worksheet tab name12 value_input_option: "USER_ENTERED" # how to interpret input values13 persist_session: true # keep Excel session open between ops (faster)14 session_timeout: 300 # seconds before session expires (default: 300)Pro tip: For SharePoint workbooks, you need the site name from the SharePoint URL. If your SharePoint URL is `https://yourcompany.sharepoint.com/sites/TeamSite/`, the site name for the Graph API path is `TeamSite`. Use `https://graph.microsoft.com/v1.0/sites?search=TeamSite` to find the exact site ID if you run into path resolution issues.
Expected result: `clawhub reload` runs without errors. OpenClaw successfully acquires a Graph API token and confirms access to the configured Excel workbook.
Find Your Workbook's Drive Item ID
Find Your Workbook's Drive Item ID
The Microsoft Graph API references Excel workbooks by their path in OneDrive/SharePoint or by a unique Drive Item ID. Paths are human-readable but can break if the file is moved or renamed. Drive Item IDs are stable — they do not change when the file is moved. For production OpenClaw workflows, using the Drive Item ID is more reliable than using the file path. To find the item ID, you can query the Graph API with the file path (which does work) and retrieve the ID from the response. OpenClaw can then cache this ID and use it for subsequent operations. For testing and initial setup, the file path approach (configured in Step 2) is easier to work with. Once the integration is working, consider switching to the item ID for stability. The Graph API also supports accessing Excel files by their path in SharePoint document libraries. The path structure differs slightly from OneDrive personal paths — the SharePoint path includes the site and drive context.
1# Get workbook item ID by path (using Graph API access token):2# Replace spaces in path with %20 for URL encoding34# For OneDrive (personal):5curl -X GET \6 'https://graph.microsoft.com/v1.0/me/drive/root:/Documents/MyWorkbook.xlsx' \7 -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \8 | python3 -m json.tool | grep '"id"'9# Returns: "id": "DRIVE-ITEM-ID-HERE"1011# For SharePoint:12curl -X GET \13 'https://graph.microsoft.com/v1.0/sites/YOUR_TENANT.sharepoint.com:/sites/TeamSite:/drive/root:/Shared%20Documents/Report.xlsx' \14 -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \15 | python3 -m json.tool | grep '"id"'1617# Use the item ID in config instead of path (more stable):18# default_workbook: "item:DRIVE-ITEM-ID-HERE"Pro tip: Save the Drive Item ID in a comment next to your `default_workbook` config line. If someone moves the Excel file to a different folder, you can quickly retrieve the new path using the stable item ID and update the config.
Expected result: You have the Drive Item ID for your Excel workbook. Optionally updated the OpenClaw config to use the item ID for more stable path resolution.
Test Reading and Writing Excel Data
Test Reading and Writing Excel Data
Test the full integration by reading existing worksheet data and writing a test row. The Graph API's Excel Workbook endpoints use a session-based model for multiple operations — OpenClaw creates a session, runs operations, and closes the session. For single operations, session-less API calls are also supported. The read test fetches cell values from a specified range using A1 notation. The write test appends a new row to the worksheet. After writing, open the workbook in Excel (desktop or browser) and verify the new row appears. The Graph API Excel endpoints are under `/v1.0/drives/{drive-id}/items/{item-id}/workbook/`. OpenClaw constructs these URLs automatically from the config, but understanding the structure helps when debugging API errors. Note that Graph API Excel operations require the workbook to not be open in exclusive (protected) mode. If a colleague has the workbook open and has locked it, API writes will fail until the lock is released.
1# Test reading worksheet data via Graph API:2curl -X GET \3 'https://graph.microsoft.com/v1.0/me/drive/root:/Documents/MyWorkbook.xlsx:/workbook/worksheets/Sheet1/range(address=%%27Sheet1%%21A1:E5%%27)/usedRange' \4 -H 'Authorization: Bearer YOUR_ACCESS_TOKEN'5# Returns: {"values": [["Header1", "Header2", ...], ["row1col1", ...]]}67# Test appending a row:8curl -X POST \9 'https://graph.microsoft.com/v1.0/me/drive/root:/Documents/MyWorkbook.xlsx:/workbook/worksheets/Sheet1/tables/Table1/rows/add' \10 -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \11 -H 'Content-Type: application/json' \12 -d '{"values": [["2026-03-30", "OpenClaw test", "Integration verified", "SUCCESS"]]}'Pro tip: If your Excel worksheet does not have a named Table, use the range-based insert approach instead of the table rows endpoint. Convert your data range to an Excel Table (Insert > Table) for easier appending — table-based append automatically expands the table range, while range-based inserts require calculating the next empty row.
Expected result: The read test returns worksheet data as a JSON array. The write test adds a new row visible when the workbook is opened in Excel. The workbook shows the correct data in the correct columns.
Configure Excel Automation Workflows
Configure Excel Automation Workflows
With the connection verified, configure OpenClaw workflows that write data to Excel workbooks automatically. The workflow patterns are similar to Google Sheets but use Graph API terminology — worksheets instead of sheets, ranges and tables instead of cell notations. For enterprise reporting, the most valuable workflow is updating named ranges or structured tables in a template workbook. Named ranges let you reference specific cells by a meaningful name (e.g., `Q1_Revenue`) rather than by cell address (e.g., `B15`). OpenClaw can update named ranges directly via the Graph API, which is more robust than cell-address-based updates that break when rows are inserted. For RapidDev clients using Microsoft 365, the Excel integration is often the most requested OpenClaw integration because it connects AI-driven data collection directly to the tools their finance and operations teams already use daily. The Graph API approach handles SharePoint permissions correctly, so the same workbook access controls that apply in Excel apply to OpenClaw's access.
1# ~/.openclaw/config.yaml — Excel automation workflows2workflows:3 research-to-excel:4 trigger:5 type: task-complete6 task_type: web-search7 actions:8 - type: excel-append-row9 integration: microsoft-excel10 workbook: "/me/drive/root:/Documents/Research Log.xlsx"11 worksheet: "Research Log"12 values:13 - "{{date:YYYY-MM-DD}}"14 - "{{time:HH:mm:ss}}"15 - "{{trigger.query}}"16 - "{{trigger.summary}}"17 - "{{trigger.source_count}}"18 - "SUCCESS"1920 named-range-update:21 trigger:22 type: schedule23 cron: "0 9 * * MON" # every Monday 9am24 actions:25 - type: excel-update-range26 integration: microsoft-excel27 workbook: "/sites/TeamSite/drive/root:/Shared Documents/Weekly Report.xlsx"28 worksheet: "Summary"29 named_range: "LastUpdated" # update the 'LastUpdated' named range30 value: "{{date:MMMM D, YYYY}}"31 - type: excel-update-range32 integration: microsoft-excel33 worksheet: "Summary"34 named_range: "WeeklySummary"35 value: "{{session.weekly_summary}}"Pro tip: Use Excel named ranges (`Insert > Name Manager`) for cells that OpenClaw updates regularly — named ranges remain stable when rows or columns are inserted, while hardcoded A1 addresses like `B15` break whenever the sheet structure changes.
Expected result: OpenClaw automatically writes data to the Excel workbook based on configured workflow triggers. Changes appear in Excel (desktop or browser) in real time for all users with access to the OneDrive/SharePoint file.
Common use cases
Enterprise Reporting Template Updates
Use OpenClaw to populate a standardized Excel reporting template stored in SharePoint. OpenClaw retrieves data from various sources (search results, databases, APIs), formats it, and writes the values to specific named cells or ranges in the template. Team members open the workbook in Excel and find it already populated with current data.
Build an OpenClaw config that writes weekly research summary data to named ranges in my Excel report template at SharePoint path /sites/TeamSite/Shared Documents/Weekly Report.xlsx
Copy this prompt to try it in OpenClaw
Data Pipeline Output to Excel
After OpenClaw runs a data extraction or processing workflow, append the results as new rows to an Excel workbook in OneDrive. The workbook serves as a running log that finance or operations team members can access directly in Excel with all their familiar formatting, formulas, and pivot table configurations intact.
Configure OpenClaw to append extracted market data rows to my Excel workbook at OneDrive path /Documents/Market Data Log.xlsx after each data collection run
Copy this prompt to try it in OpenClaw
Excel as a Configuration and Lookup Source
Read a configuration table or lookup list from an Excel workbook to drive OpenClaw workflow behavior. For example, read a list of competitor URLs from an Excel sheet and run analysis on each one, or read a product catalog from Excel and use the data to enrich other operations.
Set up OpenClaw to read the URL list from Sheet1 of my Excel workbook in OneDrive before starting a competitor analysis workflow, and process each URL in the list
Copy this prompt to try it in OpenClaw
Troubleshooting
Graph API returns 401 Unauthorized or 'InvalidAuthenticationToken'
Cause: The access token has expired (tokens are valid for 1 hour), the client secret has expired (check Azure Portal for expiry date), or the tenant ID is incorrect.
Solution: OpenClaw should refresh tokens automatically — if you see 401 errors in logs, run `clawhub reload` to force a token refresh. If the client secret has expired, create a new one in Azure Portal > App registrations > YOUR_APP > Certificates & secrets, and update `client_secret` in OpenClaw's config.
1# Test token acquisition manually:2curl -X POST \3 'https://login.microsoftonline.com/YOUR_TENANT_ID/oauth2/v2.0/token' \4 -d 'client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET&scope=https://graph.microsoft.com/.default&grant_type=client_credentials'5# If this fails, the credentials are wrong or expired — check Azure PortalGraph API returns 403 Forbidden on workbook operations
Cause: The Azure AD app does not have the required permissions (Files.ReadWrite.All or Sites.ReadWrite.All), or admin consent has not been granted for the permissions.
Solution: In Azure Portal, go to your app registration > API permissions. Verify Files.ReadWrite.All and/or Sites.ReadWrite.All are listed under 'Application permissions' (not Delegated). Check that 'Grant admin consent' has been clicked — permissions show a green checkmark when consented. If not consented, an Azure AD admin needs to approve.
1# Check app permissions status:2curl -X GET \3 'https://graph.microsoft.com/v1.0/me/drive' \4 -H 'Authorization: Bearer YOUR_ACCESS_TOKEN'5# 403 = permissions issue. 200 = permissions OK6# If 403, verify Files.ReadWrite.All is granted AND admin-consented in Azure PortalWorkbook path returns 404 or 'itemNotFound'
Cause: The file path in `default_workbook` does not match the actual file location in OneDrive or SharePoint — the file may have been moved, renamed, or the path has incorrect capitalization.
Solution: Use the Graph API to list files in the parent folder and find the correct path. If the file was moved, retrieve the stable Drive Item ID and update the config to use `item:DRIVE_ITEM_ID` format instead of the path.
1# List files in a OneDrive folder to find the correct path:2curl -X GET \3 'https://graph.microsoft.com/v1.0/me/drive/root:/Documents:/children' \4 -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \5 | python3 -m json.tool | grep -E '"name"|"id"'clawhub reload shows 'MICROSOFT_CLIENT_ID or MICROSOFT_CLIENT_SECRET not configured'
Cause: The `client_id` or `client_secret` field is missing from the `microsoft-excel` integration config, or the config YAML has incorrect indentation causing the fields to be parsed at the wrong level.
Solution: Verify both `client_id` and `client_secret` are present under `integrations.microsoft-excel` in `~/.openclaw/config.yaml` with consistent two-space indentation. Also verify `tenant_id` is configured — it is required for the client credentials OAuth flow.
1# Verify config structure (all three are required):2python3 -c "3import yaml4config = yaml.safe_load(open('/Users/$(whoami)/.openclaw/config.yaml'))5excel = config.get('integrations', {}).get('microsoft-excel', {})6print('tenant_id:', bool(excel.get('tenant_id')))7print('client_id:', bool(excel.get('client_id')))8print('client_secret:', bool(excel.get('client_secret')))9"Best practices
- Set a client secret expiry reminder in your calendar — expired secrets cause silent failures in all Excel operations and the only indication is a 401 error in OpenClaw logs. Rotate secrets every 12-18 months proactively.
- Use the Drive Item ID rather than the file path in your OpenClaw config for production workbooks — item IDs remain stable when files are moved or renamed, preventing broken integrations when SharePoint folder structures are reorganized.
- Grant only the minimum required permissions — use Files.ReadWrite.All for personal OneDrive workbooks or Sites.ReadWrite.All for SharePoint, not both. Minimizing permission scope limits the blast radius if credentials are ever compromised.
- Convert frequently-updated data ranges to Excel Tables (Insert > Table) — table-based append operations are more reliable and automatically expand the table range, whereas range-based inserts require calculating the next empty row manually.
- Use Excel named ranges for cells that OpenClaw updates on a schedule — named ranges survive row and column insertions that would otherwise shift hardcoded cell addresses, preventing data being written to the wrong cells.
- Store client credentials in OpenClaw's secrets config (not in the main config YAML that might be shared) and restrict file permissions on the config file with `chmod 600 ~/.openclaw/config.yaml`.
- Test write operations on a copy of the workbook before connecting to a production file — Graph API writes are immediate and do not have an undo operation in OpenClaw, so verifying your column mapping is correct on a test copy prevents data corruption.
Alternatives
Google Sheets uses simpler service account authentication and is better for teams not on Microsoft 365 — use it instead of Excel when your team uses Google Workspace or prefers a browser-native spreadsheet.
Outlook via Graph API covers the email and calendar side of Microsoft 365 — use it alongside Excel if you need both spreadsheet data writing and email/calendar automation in the same Microsoft 365 environment.
Notion databases provide richer data types and relational links between records — use Notion over Excel when your data requires relations, rollups, or a non-tabular structure.
Airtable combines spreadsheet ease with database features and a simpler REST API — use it instead of Excel when you need structured data with file attachments, multiple field types, or API access without Azure AD setup.
Frequently asked questions
How do I set up Microsoft Excel integration in OpenClaw?
Register an application in Azure Active Directory (portal.azure.com), grant it Files.ReadWrite.All or Sites.ReadWrite.All permissions with admin consent, and create a client secret. Configure `tenant_id`, `client_id`, `client_secret`, and `default_workbook` under `integrations.microsoft-excel` in `~/.openclaw/config.yaml`. Run `clawhub reload` to apply the config and test access to your OneDrive or SharePoint workbook.
What are MICROSOFT_CLIENT_ID and MICROSOFT_CLIENT_SECRET in OpenClaw?
MICROSOFT_CLIENT_ID is the 'Application (client) ID' from your Azure AD app registration — a UUID that identifies the app. MICROSOFT_CLIENT_SECRET is a secret value you generate in the app's 'Certificates & secrets' section — it is the password that proves OpenClaw is authorized to act as the registered app. Both are found in the Azure Portal app registration overview page.
Can OpenClaw access Excel files stored on my local computer?
No — the Microsoft Graph API only accesses Excel workbooks stored in OneDrive (personal cloud storage) or SharePoint (organizational storage). Local Excel files on your desktop are not accessible via the Graph API. To use OpenClaw with local Excel files, save the file to OneDrive first — it will remain accessible locally through OneDrive sync while also being available via the API.
Does the Microsoft Excel integration work with Excel on Mac and Windows?
Yes — the Graph API operates on the cloud-stored workbook file regardless of what platform you use to open it. OpenClaw writes to the OneDrive/SharePoint version of the file, and changes appear in Excel on Windows, Mac, or the Excel web app equally. The API is independent of the client platform.
What is the difference between using Excel and Google Sheets with OpenClaw?
Both are spreadsheet integrations, but they differ in authentication and ecosystem. Excel uses Microsoft Graph API with Azure AD application credentials (client ID + secret + tenant ID), while Google Sheets uses a service account JSON key. Excel workbooks must be in OneDrive or SharePoint; Google Sheets files live in Google Drive. Choose based on which platform your team uses — Microsoft 365 or Google Workspace.
Can RapidDev help set up Microsoft Excel integration with OpenClaw?
Yes — RapidDev can help with Azure AD app registration, Graph API permission configuration, and building OpenClaw workflows that write to Excel workbooks in OneDrive or SharePoint. Contact RapidDev if you need help with SharePoint site permissions, named range updates, or enterprise Microsoft 365 configurations that require IT admin involvement.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation