# 表格文档转换成 xlsx (Beta)

将表格文档格式转换成 xlsx 格式

## 基本信息{#base}

请求方法：`POST`

请求路径：`POST /api/developer/v1/office/save/as/xlsx`

## 目前支持的文档类型

| 文档类型 | 扩展名                                                                |
| -------- | --------------------------------------------------------------------- |
| 表格     | .et .ett .xls .xlt .xlsx .xlsm .xltx .xltm .csv .ets .eto .tpxls .log |

## Header 参数{#header}

| 参数          | 必须 | 类型   | 说明                                                                                                |
| ------------- | ---- | ------ | --------------------------------------------------------------------------------------------------- |
| Date          | 是   | string | 使用 [RFC1123](https://datatracker.ietf.org/doc/html/rfc822#section-5) 时间格式的当前时间           |
| Content-Md5   | 是   | string | `HTTP Body` 中数据的 `MD5` 值十六进制表达方式, 必需小写, 如果是 `get` 请求一律使用 `URI` 计算 `MD5` |
| Content-Type  | 是   | string | 目前固定为: `application/json`                                                                      |
| Authorization | 是   | string | "WPS-2:" + `app_id` + ":" + sha1( `app_key` + `Content-Md5` + `Content-Type` + `DATE`)              |

## Body 参数{#body}

| 参数     | 必须 | 类型   | 说明                                     |
| -------- | ---- | ------ | ---------------------------------------- |
| url      | 是   | string | 文档下载地址                             |
| filename | 是   | string | 文档名称，包含扩展名，例如：demo.xls     |
| password | 否   | string | 文档打开密码(如果文档有加密，该项则必填) |

## 返回参数{#return}
<!-- complex-table -->

| 参数 | 必须 | 类型 | 说明 |
| --- | --- | --- | --- |
| code | 是 | integer | 错误码 |
| data | 是 | data {} | 响应数据 |
| > task_id | 是 | string | 转换任务 id |

## 示例{#example}

#### 请求示例

:::httpsnippet `{"method":"POST","url":"https://solution.wps.cn/api/developer/v1/office/save/as/xlsx","headers":{"Date":"Wed, 23 Jan 2013 06:43:08 GMT","Content-Md5":"d41d8cd98f00b204e9800998ecf8427e","Content-Type":"application/json","Authorization":"WPS-2:******:ac59dac1460772a04b3a97d7ef78409f28241e3a"},"data":{"url": "https://***.com/***","filename":"demo.xls"}}`
:::

#### 返回示例

```json
{
  "code": 0,
  "data": {
    "task_id": "open:zjsiwfuotpbqblrlfwtkfkioargjbla"
  },
  "result": "ok"
}
```

## 查询异步任务结果

携带 task_id [查询结果](tasks-status.html)

### 其中 result 对象说明

| 参数 | 必须 | 类型   | 说明                             |
| ---- | ---- | ------ | -------------------------------- |
| url  | 是   | string | 转换后的文件下载地址(半小时有效) |
| size | 是   | int    | 转换后的文件大小(以字节为单位)   |

### 返回示例

```json
{
  "code": 0,
  "data": {
    "status": "success",
    "progress": 100,
    "result": {
      "url": "https://***.com/***",
      "size": 70154
    }
  }
}
```

## 错误码{#code}

请参考[错误码说明](error.md)
