Namespace: microsoft.graph
Important
APIs under the /beta
version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.
Update the properties of worksheet object.
This API is available in the following national cloud deployments.
Global service |
US Government L4 |
US Government L5 (DOD) |
China operated by 21Vianet |
✅ |
✅ |
✅ |
❌ |
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.
Permission type |
Least privileged permissions |
Higher privileged permissions |
Delegated (work or school account) |
Files.ReadWrite |
Not available. |
Delegated (personal Microsoft account) |
Files.ReadWrite |
Not available. |
Application |
Not supported. |
Not supported. |
HTTP request
PATCH /me/drive/items/{id}/workbook/worksheets/{id|name}
PATCH /me/drive/root:/{item-path}:/workbook/worksheets/{id|name}
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, supply the values for relevant fields that should be updated. Existing properties that aren't included in the request body maintains their previous values or be recalculated based on changes to other property values. For best performance you shouldn't include existing values that haven't changed.
Property |
Type |
Description |
name |
string |
The display name of the worksheet. |
position |
int |
The zero-based position of the worksheet within the workbook. |
visibility |
string |
The Visibility of the worksheet. Possible values are: Visible , Hidden , VeryHidden . |
Response
If successful, this method returns a 200 OK
response code and updated workbookWorksheet object in the response body.
Example
Request
The following example shows a request.
PATCH https://graph.microsoft.com/beta/me/drive/items/{id}/workbook/worksheets/{id|name}
Content-type: application/json
{
"position": 99,
"name": "name-value",
"visibility": "visibility-value"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new WorkbookWorksheet
{
Position = 99,
Name = "name-value",
Visibility = "visibility-value",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Drives["{drive-id}"].Items["{driveItem-id}"].Workbook.Worksheets["{workbookWorksheet-id}"].PatchAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewWorkbookWorksheet()
position := int32(99)
requestBody.SetPosition(&position)
name := "name-value"
requestBody.SetName(&name)
visibility := "visibility-value"
requestBody.SetVisibility(&visibility)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
worksheets, err := graphClient.Drives().ByDriveId("drive-id").Items().ByDriveItemId("driveItem-id").Workbook().Worksheets().ByWorkbookWorksheetId("workbookWorksheet-id").Patch(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
WorkbookWorksheet workbookWorksheet = new WorkbookWorksheet();
workbookWorksheet.setPosition(99);
workbookWorksheet.setName("name-value");
workbookWorksheet.setVisibility("visibility-value");
WorkbookWorksheet result = graphClient.drives().byDriveId("{drive-id}").items().byDriveItemId("{driveItem-id}").workbook().worksheets().byWorkbookWorksheetId("{workbookWorksheet-id}").patch(workbookWorksheet);
const options = {
authProvider,
};
const client = Client.init(options);
const workbookWorksheet = {
position: 99,
name: 'name-value',
visibility: 'visibility-value'
};
await client.api('/me/drive/items/{id}/workbook/worksheets/{id|name}')
.version('beta')
.update(workbookWorksheet);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\WorkbookWorksheet;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new WorkbookWorksheet();
$requestBody->setPosition(99);
$requestBody->setName('name-value');
$requestBody->setVisibility('visibility-value');
$result = $graphServiceClient->drives()->byDriveId('drive-id')->items()->byDriveItemId('driveItem-id')->workbook()->worksheets()->byWorkbookWorksheetId('workbookWorksheet-id')->patch($requestBody)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.workbook_worksheet import WorkbookWorksheet
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = WorkbookWorksheet(
position = 99,
name = "name-value",
visibility = "visibility-value",
)
result = await graph_client.drives.by_drive_id('drive-id').items.by_drive_item_id('driveItem-id').workbook.worksheets.by_workbook_worksheet_id('workbookWorksheet-id').patch(request_body)
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
{
"id": "id-value",
"position": 99,
"name": "name-value",
"visibility": "visibility-value"
}