Question: I have tried to use PHPExcel library to read the excel file and display data from the file. But it was not working for me.

I have also tried using [yii2-phpexcel](https://github.com/AlexGx/yii2-phpexcel) extension also other some ways but nothing worked for me. I hope I would get help from the expert personnel.

I have used PHPExcel in CakePHP to read data from excel but I have no idea how to make code workable in Yii 2. How can I load PHPExcel in Yii2? I am using XLSX. In CakePHP, I can use- 

```
App::import('Vendor', 'Excel/reader'); 
$data = new Spreadsheet_Excel_Reader();
$data->setOutputEncoding('CP1251');
$data->read(WWW_ROOT . 'uploads/' . $_FILES["filename"]["name"]);
$cells = $data->sheets[0]['cells'];

```

Thanks in advance.

Answer: 
Install [phpoffice/phpexcel](https://github.com/PHPOffice/PHPExcel) extension with composer :

```
composer require phpoffice/phpexcel

```

In your view :

```
$objPHPExcel = \PHPExcel_IOFactory::load('./test.xlsx');
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true);
print_r($sheetData);

```
As per the instruction given by Christian Lescuyer, I installed the composer dependency. but I had to edit a dependency file.

in file vendor\phpoffice\phpexcel\Classes\PHPExcel\Shared\OLE.php, line 288
I had to remove "continue;" and add "break;" in its place.