Move a named range with an Excel worksheet using Aspose.Cells Cloud API

Moving a named range is a common task when you need to reorganize data programmatically. This section explains how to relocate a defined range to a new position on the same worksheet using the Aspose.Cells Cloud REST API.

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.

Security and Authentication

The Aspose.Cells Cloud APIs are secure and require JWT token-based authentication.

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

  1. Upload the workbook to Aspose Cloud storage (if it does not already exist).
  2. Generate a JWT token using the OAuth endpoint.
  3. Build the JSON payload that describes the source range.
  4. Call the moveto endpoint with the required path, query parameters, and the JSON body.
  5. Verify the response; a successful call returns a 200 OK status.

Example Request / Response

When an error occurs, the response includes an optional ErrorMessage field that provides additional details about the failure.

HTTP Status Codes

Code Meaning Description
200 OK Filter applied successfully; response contains operation details.
400 Bad Request Missing or invalid parameters (e.g., unsupported file type).
401 Unauthorized Invalid or missing JWT token.
413 Payload Too Large Uploaded file exceeds size limit.
500 Internal Server Error Unexpected server error.

Response Schema

Field Type Description
Code integer HTTP‑like status code returned by the API (e.g., 200)
Status string Textual description of the result (e.g., “OK”)
ErrorMessage string (optional) Human‑readable error details when the call fails

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: