Skip to content

Latest commit

 

History

History
141 lines (111 loc) · 4.99 KB

nameditem-addformulalocal.md

File metadata and controls

141 lines (111 loc) · 4.99 KB
title description ms.localizationpriority author ms.subservice doc_type
Add Named Item FormulaLocal
Adds a new name to the collection of the given scope using the user's locale for the formula.
medium
ruoyingl
excel
apiPageType

Add Named Item FormulaLocal

Namespace: microsoft.graph

Adds a new name to the collection of the given scope using the user's locale for the formula.

[!INCLUDE national-cloud-support]

Permissions

Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.

[!INCLUDE permissions-table]

HTTP request

POST /me/drive/items/{id}/workbook/names/add
POST /me/drive/root:/{item-path}:/workbook/names/add
POST /me/drive/items/{id}/workbook/worksheets/{id|name}/names/add
POST /me/drive/root:/{item-path}:/workbook/worksheets/{id|name}/names/add

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
Workbook-Session-Id Workbook session Id that determines if changes are persisted or not. Optional.

Request body

In the request body, provide a JSON object with the following parameters.

Parameter Type Description
name string The name of the named item.
formula string The formula or the range that the name will refer to.
comment string The comment associated with the named item

Response

If successful, this method returns 200 OK response code and workbookNamedItem object in the response body.

Example

Here is an example of how to call this API.

Request

The following example shows a request.

POST https://graph.microsoft.com/v1.0/me/drive/items/{id}/workbook/names/addFormulaLocal
Content-type: application/json

{
  "name": "test7",
  "formula": "=SUM(Sheet2!$A$1+Sheet2!$A$2)",
  "comment": "Comment for the named item"
}

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]


Response

The following example shows the response. Note: The response object shown here might be shortened for readability.

HTTP/1.1 200 OK
Content-type: application/json

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#workbookNamedItem",
    "@odata.type": "#microsoft.graph.workbookNamedItem",
    "@odata.id": "/users('ca41eb6e-5828-486b-ab52-c3bd1f7a4047')/drive/root/workbook/names(%27test7%27)",
    "comment": "Comment for the named item",
    "name": "test7",
    "scope": "Workbook",
    "type": "String",
    "value": "0",
    "visible": true
}