public function getArryFile($paramFile) { $pathDefault = '/var/www/backup/ExternalData/default_format/'; $pathImport = '/var/www/backup/ExternalData/import_salespo/'; $fileData = $paramFile != '' ? $pathImport . $paramFile : $pathDefault . 'default_import_salespo.xlsx'; //$fileName='/var/www/backup/ExternalData/import_gudang/'.$fileData; $config = ''; //$data = \moonland\phpexcel\Excel::import($fileName, $config); $data = \moonland\phpexcel\Excel::widget(['id' => 'export-salespo-id', 'mode' => 'import', 'fileName' => $fileData, 'setFirstRecordAsKeys' => true, 'setIndexSheetByName' => true, 'getOnlySheet' => 'STOCK-SALESPO']); //print_r($data); $aryDataProvider = new ArrayDataProvider(['allModels' => $data, 'pagination' => ['pageSize' => 1000]]); //return Spinner::widget(['preset' => 'medium', 'align' => 'center', 'color' => 'blue','hidden'=>false]); return $aryDataProvider; }
public function getArryFile($paramFile) { $fileData = $paramFile != '' ? $paramFile : 'default_import_sales.xlsx'; $fileName = Yii::$app->basePath . '/web/upload/sales_import/' . $fileData; $config = ''; //$data = \moonland\phpexcel\Excel::import($fileName, $config); $data = \moonland\phpexcel\Excel::widget(['id' => 'export', 'mode' => 'import', 'fileName' => $fileName, 'setFirstRecordAsKeys' => true, 'setIndexSheetByName' => true, 'getOnlySheet' => 'IMPORT FORMAT STOCK']); //print_r($data); $aryDataProvider = new ArrayDataProvider(['allModels' => $data, 'pagination' => ['pageSize' => 1000]]); //return Spinner::widget(['preset' => 'medium', 'align' => 'center', 'color' => 'blue','hidden'=>false]); return $aryDataProvider; }
<?php use app\models\Bukutamu; // export data only one worksheet. $allModels = Bukutamu::find()->all(); \moonland\phpexcel\Excel::widget(['models' => $allModels, 'mode' => 'export', 'columns' => ['nama', 'pesan', 'tanggal']]);