Move a named range with an Excel worksheet
Contents
[
Hide
]
This REST API moves a specified range to a destination range on an Excel worksheet.
REST API
POST https://api.aspose.cloud/v3.0/cells/{name}/worksheets/{sheetName}/ranges/moveto
Authentication
The API requires a Bearer JWT token obtained through the Aspose Cloud OAuth flow. Include the token in the Authorization header:
Authorization: Bearer <jwt token>
The token must have the Cells scope.
Prerequisites
- The workbook must be stored in Aspose Cloud storage.
- Provide the storage name (
storageName) and the folder path (folder) if the file is not in the root directory. - Use the latest Aspose.Cells Cloud SDK version that supports API version v3.0.
Request Parameters
| Name | Type | Location | Description |
|---|---|---|---|
| name | string | path | Name of the workbook file |
| sheetName | string | path | Name of the worksheet |
| destRow | integer | query | Starting row index of the destination range (0‑based) |
| destColumn | integer | query | Starting column index of the destination range (0‑based) |
| range | object | body | Definition of the source range to be moved |
| folder | string | query | Folder path where the workbook is stored |
| storageName | string | query | Name of the Aspose Cloud storage |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| ColumnCount | integer | No | Number of columns in the source range |
| ColumnWidth | integer | No | Width of each column (in points) |
| FirstColumn | integer | No | Zero‑based index of the first column of the source range |
| FirstRow | integer | No | Zero‑based index of the first row of the source range |
| Name | string | No | Name of the range (if it is a named range) |
| RefersTo | string | No | A‑1 style reference that defines the range |
| RowCount | integer | No | Number of rows in the source range |
| RowHeight | integer | No | Height of each row (in points) |
| Worksheet | string | No | Worksheet that contains the source range |
Workflow
- Upload the workbook to Aspose Cloud storage (if it does not already exist).
- Generate a JWT token using the OAuth endpoint.
- Build the JSON payload that describes the source range.
- Call the
movetoendpoint with the required path, query parameters, and the JSON body. - Verify the response; a successful call returns a
200 OKstatus.
Example Request / Response
Error Codes
| HTTP Status | Code | Message | When it occurs |
|---|---|---|---|
| 400 | BadRequest | Missing or invalid parameters | Required query/path values are absent or malformed |
| 401 | Unauthorized | Invalid or expired JWT token | Authentication fails |
| 404 | NotFound | Workbook, worksheet, or named range not found | Specified resource does not exist |
| 500 | InternalServerError | Unexpected server error | Server‑side problem |
Cloud SDK Family
Using an SDK is the best way to speed up development. An SDK handles low‑level details so you can focus on your project tasks. Please check out the GitHub repository for a complete list of Aspose.Cells Cloud SDKs.
The following code examples demonstrate how to make calls to Aspose.Cells web services using various SDKs: