MS Graph: Creating an excel Workbook

Mercy Muchai 1 Reputation point

I'd like to create an excel workbook. When running the POST endpoint to create a workbook:

I get a 400 as shown below

{ "error": { "code": "BadRequest", "message": "Resource not found for the segment 'workbooks'.", "innerError": { "date": "2022-08-22T11:39:32", "request-id": "c1a9e450-a7b0-4f78-bc4f-c270deaf60ac", "client-request-id": "dc021ab9-5c0b-f03c-76c0-b1f279225f0f" } } }.

The documentation for workbooks here does not also outline the endpoint and how to run the query.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,485 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Sheena-MSFT 1,721 Reputation points

    Hi @ MercyMuchai-8764,

    Currently it is not supported to create an excel workbook using workbook resource. It only allow reading and modifying workbook that are already exist.

    As a workaround you can create an empty excel using the following Graph query:


    Hope this helps.

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

    0 comments No comments

  2. Mercy Muchai 1 Reputation point

    I'm not sure this created the workbook in the right format. When I run PUT, the workbook is created but cannot be opened due to this error.


    I observe it does not have any worksheets by default. Curious if the PUT should have a body that adds in some of that. Output when trying to create a new worksheet in it:

        "error": {  
            "code": "MetroFileFormatMismatch",  
            "message": "This workbook couldn't be opened because the file format may not be matching with the file extension.",  
            "innerError": {  
                "code": "unsupportedWorkbook",  
                "message": "The request failed. The workbook contains unsupported features or exceeds the size limit.",  
                "innerError": {  
                    "code": "MetroFileFormatMismatch",  
                    "message": "This workbook couldn't be opened because the file format may not be matching with the file extension."  
                "date": "2022-08-23T08:09:54",  
                "request-id": "**",  
                "client-request-id": "**"  

    When I try to manually open it, I get the same error: