question

GauravBaranwal-7247 avatar image
0 Votes"
GauravBaranwal-7247 asked CarlZhao-MSFT commented

Can someone help for vlookup using graph api?

Hi,

Trying to execute below request but facing 400 bad request, can someone help?

URI: https://graph.microsoft.com/v1.0/me/drive/items('id')/workbook/functions/vlookup
Method:POST
Body: {
"lookupValue": "Create",
"tableArray":"'Common Request'!D3:E7",
"colIndexNum": 2,
"rangeLookup": true
}


Response:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#workbookFunctionResult",
"@odata.type": "#microsoft.graph.workbookFunctionResult",
"@odata.id": "/users('userId')/drive/items('id')/workbook/functions/vlookup()",
"error": "#VALUE!",
"value": null
}

office-scripts-excel-devmicrosoft-graph-profilemicrosoft-graph-notes
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

CarlZhao-MSFT avatar image
0 Votes"
CarlZhao-MSFT answered CarlZhao-MSFT commented

Hi @GauravBaranwal-7247

Your api seems to be missing the workbook-session-id: {session-id} header, the full request should be:

 POST https://graph.microsoft.com/v1.0/me/drive/items/{item id}/workbook/functions/vlookup
 content-type: Application/Json
 authorization: Bearer {access-token}
 workbook-session-id: {session-id}
    
 {
     "lookupValue": "Create",
     "tableArray":"'Common Request'!D3:E7",
     "colIndexNum": 2,
     "rangeLookup": true
 }

If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @GauravBaranwal-7247 Would you please provide us with an update on the status of your issue?

0 Votes 0 ·