函数原型

  1. checkoutSheet(string $sheetName);

实例

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