How to Add a Pivot Table in an Excel Worksheet using Aspose.Cells Cloud

This REST API adds a pivot table into a worksheet.

Prerequisites:

  • An Aspose.Cells Cloud account with a valid JWT access token.
  • The target workbook must be stored in a supported storage location (default storage or a user‑specified storage).
  • The worksheet specified by sheetName must exist in the workbook.

PutWorksheetPivotTable API

PUT https://api.aspose.cloud/v3.0/cells/{name}/worksheets/{sheetName}/pivottables

Security and Authentication

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

Request parameters

Parameter Name Type Location Description
name string path The name of the Excel document.
sheetName string path The name of the worksheet where the pivot table will be created.
request object body CreatePivotTableRequest DTO containing the pivot table definition.
folder string query The folder that contains the document.
storageName string query The name of the storage where the document is located.
sourceData string query The range that provides the source data for the new pivot table cache (e.g., A5:E10).
destCellName string query The address of the upper‑left cell of the destination range for the pivot table report.
tableName string query The name assigned to the new pivot table.
useSameSource boolean query When true, the new pivot table reuses an existing data source, saving memory if another pivot table has already used this source.

The OpenAPI Specification defines a publicly accessible programming interface and lets you carry out REST interactions directly from a web browser.

You can use the cURL command‑line tool to access Aspose.Cells web services easily. The following example shows how to call the Cloud API with cURL.

Security Note: Always use https:// when calling the API and keep your JWT token confidential; transmitting it over plain HTTP can expose the token to interception.

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.

Cloud SDK Family

Using an SDK is the best way to speed up development. An SDK handles low‑level details and lets you 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 call Aspose.Cells web services using various SDKs:

For more operations, see the related API pages: Get a pivot table, Delete a pivot table, and Update a pivot table.