# Worksheet list

* The file is not supported for the `windows` system.
* Extended version is greater than or equal to `1.2.7`;
* PECL will prompt you to open the read function when installing, please type `yes`;

## Function Prototype

```php
sheetList(): array
```

## Example

```php
$excel = new \Vtiful\Kernel\Excel(['path' => './tests']);

// Build the sample file
$filePath = $excel
    // First worksheet
    ->fileName('tutorial.xlsx', 'test1')
    ->header(['sheet'])
    ->data([['test1']])

    // Second worksheet
    ->addSheet('test2')
    ->header(['sheet'])
    ->data([['test2']])

    ->output();

// Open the sample file
$sheetList = $excel->openFile('tutorial.xlsx')
    ->sheetList();

Foreach ($sheetList as $sheetName) {
    echo 'Sheet Name:' . $sheetName . PHP_EOL;

    // Get the worksheet data by the worksheet name
    $sheetData = $excel
        ->openSheet($sheetName)
        ->getSheetData();

    var_dump($sheetData);
}
```

## Sample output

```php
Sheet Name: test1
Array(2) {
  [0]=>
  Array(1) {
    [0]=>
    String(5) "sheet"
  }
  [1]=>
  Array(1) {
    [0]=>
    String(5) "test1"
  }
}
Sheet Name: test2
Array(2) {
  [0]=>
  Array(1) {
    [0]=>
    String(5) "sheet"
  }
  [1]=>
  Array(1) {
    [0]=>
    String(5) "test2"
  }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://xlswriter-docs.viest.me/english/reader/sheet_list.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
