Home > Mobile >  Microsoft Graph API: how to use the "clear" endpoint and keep columns number format on exc
Microsoft Graph API: how to use the "clear" endpoint and keep columns number format on exc

Time:07-15

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.

CodePudding user response:

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

  • Related