How to Move Worksheets in Excel – Rearrange Sheet Order & Position
Programmatically move worksheets within Excel workbooks using the Aspose.Cells Cloud API. Change sheet positions, reorder tabs, and optimize workbook structure through RESTful API calls. Perfect for automating spreadsheet organization and creating standardized workbook layouts.
Move worksheet from Spreadsheet API
Web API
PUT http://api.aspose.cloud/v4.0/cells/spreadsheet/move/worksheet?sheetName={sheetName}&position={position}&outPath={outPath}&outStorageName={outStorageName}®ion={region}&password={password}
Security and Authentication
The Aspose.Cells Cloud APIs are secure and require JWT token-based authentication.
-H "Authorization: Bearer {access_token}"
Request Parameters:
| Parameter Name | Type | Path/Query String/HTTPBody | Description |
|---|---|---|---|
| Spreadsheet | File | FormData | Required. The source Excel workbook file (.xlsx, .xls, etc.) containing the worksheet to be repositioned. |
| worksheet | String | Query | Required. The exact name of the worksheet to move (e.g., Summary, RawData_2024). |
| position | Integer | Query | Required. The new zero‑based index position for the worksheet. For example, 0 moves it to the first position, 2 moves it to become the third sheet. |
| outPath | String | Query | Optional. The target folder path in cloud storage where the reorganized workbook will be saved. If null or omitted, it defaults to the source file’s directory. |
| outStorageName | String | Query | Required. The name identifier of your configured cloud storage service (e.g., TeamDrive) where the output file will be stored. |
| region | String | Query | Optional. The locale setting (e.g., es-MX) to apply, which may influence certain formatting rules during the save operation. |
| password | String | Query | Optional. The decryption password required to open and modify a password‑protected workbook. Omit if the file is not encrypted. |
Response
[
{
"Name": "ResponseFile",
"DataType": {
"Identifier": "File",
"Reference": "Stream"
}
}
]
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. |
Where should we use the Move Worksheet in Spreadsheet API?
- Standardized Report Generation: After monthly or quarterly reports are automatically generated, the
SummaryorExecutive Overviewworksheet is moved to the top of the workbook to ensure that core conclusions are presented when the file is opened. - Data Processing Pipeline: After processing raw worksheets from different data sources in the ETL process, the
Processed_Dataworksheet that has been cleaned and transformed is moved to a logical position in the workbook (e.g., in the middle), creating a clear process structure with the original data and analysis results. - User‑Customized File Delivery: After a user selects a preferred layout through a configuration interface (such as placing the chart page at the top), the system automatically rearranges the worksheet order in the workbook according to the selection and delivers the personalized file.
Why should you use the Move Worksheet in Spreadsheet API?
- Developer‑Friendly: Aspose.Cells Cloud offers SDK libraries in multiple languages, enabling rapid development and comes with comprehensive documentation. Compared with building custom solutions, this significantly reduces development workload.
- Reduced Labor Costs: Reduces the need for personnel dedicated to document consolidation.
- Pay‑per‑Use: No upfront investment; you only pay for the API calls you actually use.
- Zero Maintenance Costs: No need to maintain servers, update software, or deal with compatibility issues.
How to Use the Move Worksheet in Spreadsheet API with SDKs
Move Worksheet in Spreadsheet API Specification
The Move Worksheet in Spreadsheet API Specification provides a publicly accessible programming interface to facilitate direct REST interactions 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 make calls to the Cloud API with cURL.
Use Aspose.Cells Cloud SDKs
Using an SDK is the fastest way to develop, as it abstracts away low‑level details, allowing you to move worksheets in the spreadsheet with concise code. Please check out the GitHub repository for a complete list of Aspose.Cells Cloud SDKs.
The following code examples demonstrate how to call the Aspose.Cells web services using various SDKs: