Group Columns in Excel Using Aspose.Cells Cloud REST API v3.0

The PostGroupWorksheetColumns API (POST https://api.aspose.cloud/v3.0/cells/{name}/worksheets/{sheetName}/cells/columns/group) enables programmatic grouping of worksheet columns in Aspose.Cells Cloud, allowing developers to define collapsible column ranges by specifying first and last column indices, with optional control over visibility via the hide parameter—ideal for automating interactive Excel dashboards and reports that mirror native Excel grouping behavior.

Overview

Grouping columns in Excel enables you to create collapsible sections, improving data readability and user interaction. With Aspose.Cells Cloud, you can programmatically group ranges of columns—ideal for automating dashboard generation, report formatting, or interactive workbook creation. This API supports immediate visibility control (e.g., collapse/expand on creation), ensuring your Excel workflows mirror native Excel behavior.

The Post Group Worksheet Columns Web API

POST https://api.aspose.cloud/v3.0/cells/{name}/worksheets/{sheetName}/cells/columns/group

Security and Authentication

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

Request Parameters

Parameter Name Type Path/Query String/HTTPBody Description
name String Path The file name.
sheetName String Path The worksheet name.
firstIndex Integer Query The first column index to be operated.
lastIndex Integer Query The last column index to be operated.
hide Boolean Query columns visible state
folder String Query The folder where the file is situated.
storageName String Query The storage name where the file is situated.

Response

[
  {
    "Name": "CellsCloudResponse",
    "DataType": {
      "Identifier": "Class",
      "Reference": "CellsCloudResponse"
    }
  }
]

Sample response headers

HTTP/1.1 200 OK
Content-Type: application/json

HTTP Status Codes

Code Meaning Description
200 OK The request completed successfully.
400 Bad Request The request is malformed or one or more parameters are invalid.
401 Unauthorized Authentication failed, or the JWT token is missing or expired.
404 Not Found The requested workbook, worksheet, or resource was not found.
500 Internal Server Error The server encountered an unexpected error while processing the request.

Notes

  • Column indices are zero-based (e.g., column A = index 0, column B = index 1).
  • Setting hide=true immediately collapses the group, matching Excel’s UI behavior.

Request Example (cURL)

curl -X POST "https://api.aspose.cloud/v3.0/cells/test.xlsx/worksheets/Sheet1/cells/columns/group?firstIndex=1&lastIndex=3&hide=true" \
     -H "accept: application/json" \
     -H "Authorization: Bearer <access_token>"

Response

Success (200 OK)

Field Type Description
Code integer HTTP status code (200).
Status string Operation status (OK).

Example Response:

{
  "Code": 200,
  "Status": "OK"
}

Example – Bad Request (400):

{
  "Code": 400,
  "Status": "Error",
  "ErrorMessage": "Invalid column index: lastIndex must be greater than or equal to firstIndex.",
  "ErrorCode": "InvalidParameter"
}

How to Use the Post Group Worksheet Columns API with SDKs?

Post Group Worksheet Columns API Specification

The Post Group Worksheet Columns API Specification defines a publicly accessible programming interface and enables you to carry out REST interactions directly from a web browser.

Use Aspose.Cells Cloud SDKs

Using the SDK is the fastest way to develop, as it abstracts away the low‑level details, allowing you to use the API with short code.
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: