Error while uploading Excel file using Graph api

Kashif Quadri 1 Reputation point
2022-10-28T07:33:36.943+00:00

I would like to upload an excel file using Graph API. When I upload the file and try to open file, it is giving error "This workbook couldn't be opened because the file format may not be matching with the file extension."

language: Nodejs

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

1 answer

Sort by: Most helpful
  1. Shivam Dhiman 6,086 Reputation points
    2022-10-28T15:30:43.793+00:00

    Hi @Kashif Quadri

    To Upload excel file use this PUT /me/drive/items/{parent-id}:/{filename}:/content Graph API. In body, select binary as format and attach file with content.

    Please refer to the below sample screenshot.
    255149-ss.png

    Please note: To upload large files you need to use Upload Session, Please refer to this documentation for more details.

    Hope this helps.

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

    0 comments No comments

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.