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 |
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]
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]
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
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. |
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 |
If successful, this method returns 200 OK
response code and workbookNamedItem object in the response body.
Here is an example of how to call this API.
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]
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
}