public function showFormat() { //get the link of the file $file = new Files($this->formatfile_id); $path = $file->fileWithPath(); if (preg_match("/xlsx\$/", $file->originalname) != 0) { Yii::import('application.vendors.simplexlsx.*'); $xlsx = new SimpleXLSX($excelfile); return $xlsx->dump(); } else { if (preg_match("/xls\$/", $file->originalname) != 0) { Yii::import('application.vendors.php-excel-reader.*'); $xls = new Spreadsheet_Excel_Reader($excelfile); return $xls->dump(); } } }