init
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user