lib/components/dataInterface/connectors/file/SourceFile.php
protected function convertExcel($filepath, $tmpfile, $filetype = 'Excel2007')
    {
        $this->_loadExcel();
        $fileCacheKey = md5(serialize([__CLASS__, __FUNCTION__, $this->id, $this->url, $this->local]));
        $test = Yii::$app->fileCache->get($fileCacheKey);
        if ($test) {
            file_put_contents($tmpfile, $test);

            return $tmpfile;
        }
        echo "Converting {$filepath}...\n";
        if (!class_exists('\PHPExcel_IOFactory')) {
            $this->_unloadExcel();
            throw new Exception("Unable to load PHPExcel library!");
        }
        $objReader = \PHPExcel_IOFactory::createReader($filetype);
        $objPHPExcelReader = $objReader->load($filepath);
        $loadedSheetNames = $objPHPExcelReader->getSheetNames();
        $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcelReader, 'CSV');
        foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) {
            $objWriter->setSheetIndex($sheetIndex);
            $objWriter->save($tmpfile);
            break;
        }
        $this->_unloadExcel();
        Yii::$app->fileCache->set($fileCacheKey, file_get_contents($tmpfile), 86400);

        return $tmpfile;
    }
protected function convertExcel($filepath, $tmpfile, $filetype = 'Excel2007')
    {
        $this->_loadExcel();
        $fileCacheKey = md5(serialize([__CLASS__, __FUNCTION__, $this->id, $this->url, $this->local]));
        $test = Yii::$app->fileCache->get($fileCacheKey);
        if ($test) {
            file_put_contents($tmpfile, $test);

            return $tmpfile;
        }
        echo "Converting {$filepath}...\n";
        if (!class_exists('\PHPExcel_IOFactory')) {
            $this->_unloadExcel();
            throw new Exception("Unable to load PHPExcel library!");
        }
        $objReader = \PHPExcel_IOFactory::createReader($filetype);
        $objPHPExcelReader = $objReader->load($filepath);
        $loadedSheetNames = $objPHPExcelReader->getSheetNames();
        $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcelReader, 'CSV');
        foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) {
            $objWriter->setSheetIndex($sheetIndex);
            $objWriter->save($tmpfile);
            break;
        }
        $this->_unloadExcel();
        Yii::$app->fileCache->set($fileCacheKey, file_get_contents($tmpfile), 86400);

        return $tmpfile;
    }
[[@doctodo method_description:convertExcel]].

@param [[@doctodo param_type:filepath]] $filepath [[@doctodo param_description:filepath]]
@param [[@doctodo param_type:tmpfile]]  $tmpfile  [[@doctodo param_description:tmpfile]]
@param string                           $filetype [[@doctodo param_description:filetype]] [optional]

@throws Exception [[@doctodo exception_description:Exception]]
@return [[@doctodo return_type:convertExcel]] [[@doctodo return_description:convertExcel]]