Skip to content

[Bug] Cannot modify SharePoint Excel files due to a sequence of 403 WAC token and 404 Not Found errors #20040

@adepreville-mkg

Description

@adepreville-mkg

Environment

n8n: 1.110.1 (Self-hosted)
Microsoft 365 tenant: SharePoint Online (team document library)
Authentication: Microsoft Graph OAuth2 delegated (Authorization Code)

Summary

The Microsoft Excel 365 node cannot reliably target a workbook stored in SharePoint.

The Workbook locator offers “By ID” (no “By URL”) but does not clearly state that the ID must be the Microsoft Graph driveItem.id of the file (not a list/library/item ID).

Even when a valid driveItem.id is provided, the Sheet and Table dropdowns are empty for many SharePoint-hosted workbooks.

Calling Graph Excel endpoints (/workbook/...) to resolve worksheet/table IDs frequently returns 403 AccessDenied: “Could not obtain a WAC access token.”, while non-Excel Graph endpoints for the same file work.

This produces a dead-end: the Excel node requires worksheet/table IDs, but the APIs to fetch them often fail with WAC 403; and the UI does not provide a “By URL” fallback like Google Sheets.

Actual behavior

Workbook “By ID” accepts values but Sheet/Table selectors remain empty for SharePoint files.

Attempting to fetch worksheet/table IDs via Graph Excel endpoints results in 403:

403 AccessDenied
"Could not obtain a WAC access token."
request-id: <redacted-guid>

Non-Excel endpoints (Drive/Items metadata) succeed for the same file.

Workarounds

Round-trip approach: SharePoint Download → Spreadsheet File node for local edits → SharePoint Upload (overwrite). Avoids Excel /workbook API and WAC.

If tenant policies/licensing allow: POST /workbook/createSession then repeat worksheets/tables with the workbook-session-id header. Still unreliable on some tenants.

Request
Add Workbook → “By URL”.
Improve SharePoint discovery in the Workbook locator and Sheet/Table selectors.
Validate ID types in the UI with explicit error messages.
Update documentation to specify that Workbook → “By ID” expects Graph driveItem.id and document how to resolve worksheet/table IDs for SharePoint files.

To Reproduce

Use Microsoft SharePoint → Item: Get to retrieve a document-library item that represents an .xlsx.

Resolve the file’s Graph driveItem via Graph:

GET https://graph.microsoft.com/v1.0/sites/{siteCompositeId}/lists/{listId}/items/{itemId}/driveItem?$select=id,name,parentReference

Response (sanitized):


{
  "id": "01ABCDEFNLMZJVT535BNB3WDNLWH7TAAAA",
  "name": "Report.xlsx",
  "parentReference": { "driveId": "b!xxxx...yyyy" }
}

Try to list worksheets:

GET https://graph.microsoft.com/v1.0/drives/{driveId}/items/{driveItemId}/workbook/worksheets?$select=id,name

Often returns:

403 AccessDenied
"Could not obtain a WAC access token."

Configure Microsoft Excel 365 node:

Resource: worksheet (or table)
Operation: append (or any)
Workbook → By ID = the driveItem.id from step 2

Sheet/Table: attempt to select from list → list is empty; switch to “By ID” → you now need worksheet.id/table.id, which you can’t obtain due to step 3.

Error log (sanitized)

403 - {"error":{"code":"AccessDenied",
"message":"Could not obtain a WAC access token.",
"innerError":{"date":"<timestamp>",
"request-id":"<redacted-guid>",
"client-request-id":"<redacted-guid>"}}}

Minimal reproducible workflow (sanitized)

{
  "name": "excel-sharepoint-repro",
  "nodes": [
    {
      "id": "trigger-1",
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [-600, -400],
      "parameters": {}
    },
    {
      "id": "sp-get-item",
      "name": "SharePoint: Get an item",
      "type": "n8n-nodes-base.microsoftSharePoint",
      "typeVersion": 1,
      "position": [-420, -400],
      "parameters": {
        "resource": "item",
        "operation": "get",
        "site": { "__rl": true, "mode": "list", "value": "tenant.sharepoint.com,<site-collection-guid>,<site-guid>", "cachedResultName": "Team Site A" },
        "list": { "__rl": true, "mode": "list", "value": "<list-guid>", "cachedResultName": "Documents" },
        "item": { "__rl": true, "mode": "id", "value": "<item-id>" },
        "simplify": false
      }
    },
    {
      "id": "resolve-driveitem",
      "name": "HTTP: Resolve driveItem",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [-220, -400],
      "parameters": {
        "authentication": "genericCredentialType",
        "genericAuthType": "oAuth2Api",
        "url": "={{ `https://graph.microsoft.com/v1.0/sites/${$json.parentReference.siteId}/lists/${$json.parentReference.listId}/items/${$json.id}/driveItem?$select=id,name,parentReference` }}"
      },
      "credentials": { "oAuth2Api": { "id": "<redacted>", "name": "<Graph OAuth2>" } }
    },
    {
      "id": "list-worksheets",
      "name": "HTTP: List worksheets",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [-20, -400],
      "parameters": {
        "authentication": "genericCredentialType",
        "genericAuthType": "oAuth2Api",
        "url": "={{ `https://graph.microsoft.com/v1.0/drives/${$json.parentReference.driveId}/items/${$json.id}/workbook/worksheets?$select=id,name` }}"
      },
      "credentials": { "oAuth2Api": { "id": "<redacted>", "name": "<Graph OAuth2>" } }
    },
    {
      "id": "excel-append",
      "name": "Excel 365: Append data to sheet",
      "type": "n8n-nodes-base.microsoftExcel",
      "typeVersion": 2.1,
      "position": [180, -400],
      "parameters": {
        "resource": "worksheet",
        "operation": "append",
        "workbook": { "__rl": true, "mode": "id", "value": "={{ $('resolve-driveitem').item.json.id }}" },
        "worksheet": { "__rl": true, "mode": "id", "value": "={{ $json.value[0].id }}" },
        "fieldsUi": { "values": [ {} ] }
      },
      "credentials": { "microsoftExcelOAuth2Api": { "id": "<redacted>", "name": "<Excel OAuth2>" } }
    }
  ],
  "connections": {
    "Manual Trigger": { "main": [[{ "node": "SharePoint: Get an item", "type": "main", "index": 0 }]] },
    "SharePoint: Get an item": { "main": [[{ "node": "HTTP: Resolve driveItem", "type": "main", "index": 0 }]] },
    "HTTP: Resolve driveItem": { "main": [[{ "node": "HTTP: List worksheets", "type": "main", "index": 0 }]] },
    "HTTP: List worksheets": { "main": [[{ "node": "Excel 365: Append data to sheet", "type": "main", "index": 0 }]] }
  }
}

Expected behavior

Allow Workbook → By URL so a SharePoint file URL can be pasted directly, or Reliably list workbooks/worksheets/tables/sheet from SharePoint sites via the built-in locators, and
If an invalid ID type is supplied (e.g., list ID vs driveItem.id), show a clear validation error instead of empty selectors.

Debug Info

The Excel node likely relies on WAC/Excel Online under the hood. When the WAC token cannot be issued (license, policy, or internal handling), /workbook/... fails while non-Excel endpoints succeed.

The UI does not distinguish between invalid ID types (library/list vs driveItem.id), producing silent empty selectors.

Compared to Google Sheets, the lack of “By URL” significantly increases friction for SharePoint-hosted workbooks.

Operating System

ubuntu 22.4

n8n Version

1.110.1

Node.js Version

Node: n8n-nodes-base.microsoftExcel v2.1 Node: n8n-nodes-base.httpRequest v4.2 Node: n8n-nodes-base.microsoftSharePoint v1

Database

SQLite (default)

Execution mode

main (default)

Hosting

self hosted

Metadata

Metadata

Assignees

No one assigned

    Labels

    in linearIssue or PR has been created in Linear for internal review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions