Is there any REST API for creating new Excel (.xlsx) file in OneDrive cloud

New Contributor

I'm trying to create a new excel file in OneDrive with the below properties of the REST API call.

URL: Body:

    "name": "MyFile.xlsx",
    "file": {},
    "@microsoft.graph.conflictBehavior": "rename"

Header: Content-Type:application/json

With the help of the above properties, I'm able to create the file in OneDrive. But it is created without size & If I try to open the workbook it says Couldn't Open the Workbook Error The workbook cannot be opened.

Basically, whenever I create a new excel file from UI it has a default size of 7.81KB (Could be used for metadata of file).

I have taken reference from

Is there anyone who knows how to resolve this issue?

2 Replies

@harshadpanmand I'm also facing the same issue. did you find any solution to it?

I did not found any solution.
One suggested solution I found was, keep empty file(Original file created from UI) at one directory and while creating new file just copy Original file.