> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kasoftware.com/llms.txt
> Use this file to discover all available pages before exploring further.

# excelListSheets

> 列出 Excel 工作簿中的工作表，可通过文件路径或已打开的工作簿句柄访问。

列出指定的 Excel 工作簿中的工作表。

## 可选的参数

* **version**：目标工作簿的 Excel 版本。 允许的值为`AUTO`、`95`、`97-2003`、`2007`。 默认为`自动`。
* **file**：Excel 工作簿在磁盘上的完整路径，包括文件名。 必须指定`file`或`handle`参数。
* **handle**：对[excelOpen](./op-excel-open)创建的Excel数据的可读句柄引用。 如果指定`file`参数，则不需要`handle`。

## 输出属性

* **sheet**：目标工作簿中当前工作表的名称。
* **ishidden**：一个布尔值（true/false），指示当前工作表是否隐藏在工作簿中。

## 示例

在此示例中，列出了目标 Excel 工作簿的工作表并将其添加到文件中，然后将其作为脚本的输出推送。

```xml theme={null}
<!-- Initializing the output item of the script -->
<arc:set attr="output.data" />
<!-- Creating the input item for the operation and passing it in -->
<arc:set attr="excel.file" value="C:\Temp\movies.xlsx" />
<arc:set attr="excel.version" value="2007" />
<arc:call op="excelListSheets" in="excel" out="sheets">
  <!-- Creating some output data and file from the sheet names in the workbook -->
  <arc:set attr="output.data" value="[output.data]\nSheet = [sheets.sheet] | Hidden = [sheets.ishidden]" />
  <arc:set attr="output.filename" value="results.txt" />
</arc:call>
<!-- Push the output item out as a file -->
<arc:push item="output" />
```

该脚本的输出如下所示：

```
Sheet = music | Hidden = false
Sheet = tvshows | Hidden = true
Sheet = film | Hidden = false
```
