question

GopiRadhika-0333 avatar image
0 Votes"
GopiRadhika-0333 asked Jagan-2320 answered

Upload an excel file using graph API

Hi @MichaelHan-MSFT
I would like to upload an excel file using Graph API. When I create using the URL "https://graph.microsoft.com/v1.0/sites/<tenantID followed by the other ID's>/drive/root:/test/FileNew.xlsx:/content:
it creates the file, but when trying to open it the following "Couldn't open the workbook" error occurs:

![103983-image.png][1]


Any help is appreciated.

office-sharepoint-onlineoffice-excel-itpromicrosoft-graph-applications
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.

MichaelHan-MSFT avatar image
0 Votes"
MichaelHan-MSFT answered GopiRadhika-0333 commented

Hi @GopiRadhika-0333,

In request body, it should be the binary stream of the file to be uploaded.

In Postman, we could choose binary type in body. Then select the file you want to upload. As the below picture shows:


104030-image.png


If an Answer is helpful, please click "Accept Answer" and upvote it.
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.



image.png (26.3 KiB)
· 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.

Jagan-2320 avatar image
0 Votes"
Jagan-2320 answered

@MichaelHan-MSFT, I'm running into similar kind of issue without using Postman. When i use Postman everything works fine, but when using it from my application, the pdfs, docs, ppts, images are coming as blank.
I'm converting a file from base64 to binary (using atob function) and sending that binary data in the body.

Language: AngularJS

Any help will be really appreciated.

Thanks in Advance!!!

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.