Using Graph API in an app to read and write from an Excel Workbook

2023-12-12T13:48:54.4633333+00:00

I'm looking for a way to have my application read and write from an Excel workbook without being logged in. when I try to generate my own access token using the /ouath2/v2.0/token endpoint and use it to write data to the Excel workbook, it returns an error. The error is "method is not allowed". In my application i have given permission to:
Application.ReadWrite.All, Directory.ReadWrite.All and Files.ReadWrite.All. Im following this guide here: https://learn.microsoft.com/en-us/graph/auth-v2-service?tabs=http. Im also able to read info via the API about users and data in my excel workbook from within the organisation but im not able to use this request:

https://graph.microsoft.com/v1.0/users/{userid}/drive/items/{ExcelItemID}/workbook/worksheets('Ark1')/range(address='A1')"

this is with the request im getting the method not allowed.

Microsoft 365 and Office Excel For business Windows
Microsoft Security Microsoft Graph
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 46,366 Reputation points
    2023-12-13T05:48:53.49+00:00

    Hi @Oliver Chrestensen - Brand By Hand ApS

    This API does not yet support application permissions. You can only read or write to the logged-in user's worksheet range and cannot perform this operation for other users.

    User's image

    Hope this helps.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.