切换工作表

函数原型

1
checkoutSheet(string $sheetName);
Copied!

实例

1
$config = [
2
'path' => './tests'
3
];
4
5
$excel = new \Vtiful\Kernel\Excel($config);
6
$fileObject = $excel->fileName("tutorial01.xlsx");
7
8
$fileObject->header(['name', 'age'])
9
->data([
10
['viest', 21],
11
['viest', 22],
12
['viest', 23],
13
]);
14
15
// 添加工作表,并插入数据
16
$fileObject->addSheet('twoSheet')
17
->header(['name', 'age'])
18
->data([['vikin', 22]]);
19
20
// 切换回默认工作表,并追加数据
21
$fileObject->checkoutSheet('Sheet1')
22
->data([['sheet1']]);
23
24
$filePath = $fileObject->output();
Copied!
Copy link