使用 Aspose.Cells Cloud API 在 Excel 工作表中复制列
Contents
[
Hide
]
此 REST API 可在 Excel 工作表中复制列。复制列操作允许您复制单个列或一列范围,并将副本插入同一工作表内的指定位置。在处理大型电子表格时,可使用此端点高效地复制列;有关其他列管理任务,请参考相关操作,例如添加列和隐藏列。
安全性与身份验证
Aspose.Cells Cloud API 采用安全机制,需要 基于 JWT 令牌的身份验证。
REST API
POST https://api.aspose.cloud/v3.0/cells/{name}/worksheets/{sheetName}/cells/columns/copy
请求参数
| 参数名称 | 类型 | 位置 | 描述 |
|---|---|---|---|
| name | string | path | 工作簿名称。 |
| sheetName | string | path | 工作表名称。 |
| sourceColumnIndex | integer | query | 要复制的列的从 0 开始的索引。 |
| destinationColumnIndex | integer | query | 要插入复制列(或多列)的从 0 开始的索引。 |
| columnNumber | integer | query | 要复制的连续列的数量。 |
| worksheet | string | query | (可选) 当工作表名称与路径不一致时使用的工作表标识符。 |
| folder | string | query | Aspose Cloud 存储中包含工作簿的文件夹路径。 |
OpenAPI 规范定义了此操作的完整契约。
cURL 示例
curl -X POST "https://api.aspose.cloud/v3.0/cells/test.xlsx/worksheets/Sheet1/cells/columns/copy?sourceColumnIndex=1&destinationColumnIndex=12&columnNumber=10" \
-H "Authorization: Bearer $ASPOSE_TOKEN" \
-H "accept: application/json"
响应
{
"Code": 200,
"Status": "OK"
}
错误处理
API 返回标准 HTTP 状态码,并附带 JSON 格式的错误描述信息。
| 状态码 | 含义 | 示例 JSON 响应体 |
|---|---|---|
| 400 | 错误请求 – 参数无效 | { "Code": 400, "Message": "Invalid column index." } |
| 401 | 未授权 – 缺失或无效的令牌 | { "Code": 401, "Message": "Access token is invalid or expired." } |
| 404 | 未找到 – 工作簿或工作表不存在 | { "Code": 404, "Message": "Workbook not found." } |
| 500 | 服务器内部错误 – 意外情况 | { "Code": 500, "Message": "An unexpected error occurred." } |
故障排除方法: 请确认访问令牌有效、工作簿和工作表名称正确,并且
sourceColumnIndex、destinationColumnIndex和columnNumber均在工作表列范围内。
云 SDK 家族
使用 SDK 是加快开发速度的最佳方式。SDK 会处理底层细节,使您能专注于项目任务。请查阅 GitHub 仓库,获取 Aspose.Cells Cloud SDK 的完整列表。
以下代码示例展示了如何使用不同 SDK 调用 Aspose.Cells Web 服务: