> ## 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
```
