How to Get Range Content from an Excel Worksheet – Aspose.Cells Cloud API

Working with retrieving range content in an Excel worksheet

The Get Range operation returns the content of a specified range in a worksheet.
It is a simple GET request that returns the range data in JSON format (or other formats when requested).

Request Overview

Element Value
HTTP Method GET
Endpoint https://api.aspose.cloud/v3.0/cells/{fileName}/worksheets/{sheetName}/ranges/{rangeName}
Path Parameters fileName – name of the Excel file (including extension)
sheetName – name of the worksheet
rangeName – name of the range (e.g., A1:B10)
Query Parameters (optional) folder – storage folder
storage – storage name
outFormat – response format (e.g., json, xml)
Headers Authorization: Bearer <access_token>
Accept: application/json

Sample cURL

curl -X GET "https://api.aspose.cloud/v3.0/cells/Book1.xlsx/worksheets/Sheet1/ranges/A1:B10?folder=Samples&storage=MyStorage" \
     -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
     -H "Accept: application/json"

Sample C#

using Aspose.Cells.Cloud.SDK.Api;
using Aspose.Cells.Cloud.SDK.Model.Requests;

var apiInstance = new CellsApi("client_id", "client_secret");
var request = new GetRangeRequest(
    name: "Book1.xlsx",
    sheetName: "Sheet1",
    rangeName: "A1:B10",
    folder: "Samples",
    storage: "MyStorage"
);
var response = apiInstance.GetRange(request);
Console.WriteLine(response);

Sample Java

import com.aspose.cells.cloud.api.CellsApi;
import com.aspose.cells.cloud.model.requests.GetRangeRequest;

CellsApi api = new CellsApi("client_id", "client_secret");
GetRangeRequest request = new GetRangeRequest(
        "Book1.xlsx",
        "Sheet1",
        "A1:B10",
        "Samples",
        "MyStorage",
        null,
        null);
var response = api.getRange(request);
System.out.println(response);

Sample Python

from asposecellscloud import CellsApi, GetRangeRequest

api = CellsApi(client_id="client_id", client_secret="client_secret")
request = GetRangeRequest(
    name="Book1.xlsx",
    sheet_name="Sheet1",
    range_name="A1:B10",
    folder="Samples",
    storage="MyStorage"
)
response = api.get_range(request)
print(response)

Response Schema (JSON)

{
  "Code": 200,
  "Status": "OK",
  "Range": {
    "ColumnCount": 2,
    "RowCount": 1,
    "FirstRow": 0,
    "FirstColumn": 0,
    "Values": [
      ["Value1", "Value2"]
    ]
  }
}

Possible Status Codes

  • 200 OK – Range retrieved successfully.
  • 400 Bad Request – Missing or invalid parameters.
  • 401 Unauthorized – Invalid or missing access token.
  • 404 Not Found – Specified file, worksheet, or range does not exist.
  • 500 Internal Server Error – Unexpected server error.

See also