0
votes

I am trying to get an Excel online row via graph api but the call fails for 400 Client Error: Bad Request for url

I don't know what I am doing wrong please help

I tried V1.0 and beta with the same result

requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://graph.microsoft.com/beta/sites/mysite/drives/mydrive/workbook/worksheets('%7B my worksheet id %7D')/tables('%7B my table id %7D')/rows/1 | Error Message: The API you are trying to use could not be found. It may be available in a newer version of Excel.

1
Please share the requestid and timestamp for this failed request.Shiva Keshav Varma

1 Answers

0
votes

As the error message says, there is no such API endpoint that can pull a row directly. But Microsoft provides you a way to get that data. You can use the query parameters $top and $skip to pull any row as shown below.

I am trying to get the 4th record in my list

enter image description here

Now I will use the Top and Skip query parameters in my query as below.

https://graph.microsoft.com/v1.0/sites/{siteid}/drives/{Driveid}/Items/{Itemid}/workbook/worksheets/Sheet1/tables/Table1/rows?$top=1&$skip=3

You can see that I was able to pull the 4th record by giving the skip value 3 in it. So you need to keep $Top as 1 to pull one record and $skip value will vary with the RequiredRow - 1.

enter image description here