Graph Workbook API - Update row

Paul Backhouse 0 Reputation points
2023-07-20T10:39:43.3566667+00:00

Hi,

I'm trying to update a row using the API documented here:

https://learn.microsoft.com/en-us/graph/api/tablerow-update?view=graph-rest-1.0&tabs=http

The PATCH .../rows/{index} doesn't work for me, response is:

{
    "error": {
        "code": "ApiNotFound",
        "message": "The API you are trying to use could not be found. It may be available in a newer version of Excel. Please refer to the documentation: “https://docs.microsoft.com/office/dev/add-ins/reference/requirement-sets/excel-api-requirement-sets”.",
        "innerError": {
            "code": "apiNotFound",
            "message": "The API you are trying to use could not be found. It may be available in a newer version of Excel. Please refer to the documentation: “https://docs.microsoft.com/office/dev/add-ins/reference/requirement-sets/excel-api-requirement-sets”.",
            "date": "2023-07-20T10:21:12",
            "request-id": "0541cf3e-3561-4118-bd52-20da86505b11",
            "client-request-id": "71084294-eed4-5870-f2e9-64385ff775cb"
        }
    }
}

I've seen references to an "undocumented" API, using /rows/itemAt(index={index}), which does return a 200 OK.

However, I cannot insert a full row of data with this API. I'd expect to be able to PATCH something like this:

{
    "values": [
        "1",
        "2"
    ]
}

Because that's what is reflected back in the response.

But the only payload that works is is string for "values"

{
    "values": "1"
}

Unfortunately, this updates every cell in the row with that one value.

So, how can I use the Graph API to update a row in a worksheet table?

Microsoft Security Microsoft Graph
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Ab-8756 805 Reputation points
    2023-08-10T18:27:04.63+00:00

    Hello Paul Backhouse,
    Thank you for reaching out to this Q&A forum.

    To update a row in a worksheet table you can use the below approach;-
    PATCH,https://graph.microsoft.com/v1.0/me/drive/items/01DLDARAVPSYF3IMDZJZCISWNBLJ4FJZ3J/workbook/worksheets('sheet1')/range(address='A3:C3')

    with the body;-

    {
        "values": [
            [
                "A1",
                "B1",
                "C1"
            ]
        ]
    }
    

    This endpoint will add the above values to row in the A3:C3 location.
    User's image

    Hope this answer your question.

    --please don't forget to upvote and Accept as answer if the reply is helpful—
    Thanks

    0 comments No comments

  2. Ab-8756 805 Reputation points
    2023-08-11T19:31:19.88+00:00

    Hello Paul Backhouse,
    I would like to follow up and inquire if you have any questions or if you found my suggestion helpful.
    Thanks.


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.