Share via

Can someone help for vlookup using graph api?

Anonymous
2022-03-29T07:59:31.187+00:00

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
}

Microsoft 365 and Office | Development | Other
Microsoft Security | Microsoft Graph
0 comments No comments

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 46,456 Reputation points
    2022-03-29T09:13:49.11+00:00

    Hi @Anonymous

    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.

    Was this answer helpful?


Your answer

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