setDelimiter(';'); $reader->stripBom(true); /*$contents = $reader->__toString(); if (!Utf8::isUtf8($contents)) { // If file is not in utf8 try converting to ISO-8859-15 if ($reader->getStreamFilterMode() == 1) { $reader->appendStreamFilter('convert.iconv.ISO-8859-15/UTF-8'); } }*/ $iterator = $reader->fetchAssoc(0); return iterator_to_array($iterator); } return []; } /** * @param string $filename * * @return array */ public static function xlsToArray($filename) { if (empty($filename)) { return []; } $file = new \SplFileObject($filename); $reader = new ExcelReader($file, 0); return $reader; } }