Mauricio
Mauricio

Reputation: 3129

Microsoft Graph API: how to use the "clear" endpoint and keep columns number format on excel file?

My application uses Microsoft Graph API for inserting data on Excel Files. Before inserting the new data, we need to clear the previous one. The problem is that everytime we call the clear endpoint, all the number formating like currency, date, etc., is lost.

Upvotes: 0

Views: 360

Answers (1)

user2250152
user2250152

Reputation: 20778

The clear endpoint

POST /me/drive/items/{id}/workbook/names/{name}/range/clear

has optional parameter applyTo in request body which determines the type of clear action. The possible values are: All, Formats, Contents.

If you set Contents it should clear only values in cells and preserves formatting etc.

{
  "applyTo": "Contents"
}

Resource:

range clear

Upvotes: 1

Related Questions