Files
stemcell/app/code/Stemcell/Catalog/Helper/Excel.php
T
2026-09-15 10:26:34 +08:00

23 lines
509 B
PHP

<?php
namespace Stemcell\Catalog\Helper;
use PhpOffice\PhpSpreadsheet\IOFactory;
class Excel
{
/**
* @param string $filePath 文件路径
* @return \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet
* @throws \Exception
*/
public static function getExcelSheet(string $filePath)
{
if (!file_exists($filePath)) {
throw new \Exception(sprintf('File %s does not exist', $filePath));
}
return IOFactory::load($filePath)->getActiveSheet();
}
}