Excel file reader for Yii Framework.
Requirements ¶
Yii 1.1 above
Usage ¶
Within your configuration files (usually found under /protected/config/) there is the "components" section. Just like your db and cache components, we'll need to add in our own configuration for this. Add in the following code within the components section:
'yexcel' => array(
'class' => 'ext.yexcel.Yexcel'
),
Simple usage of this extenstion:
$sheet_array = Yii::app()->yexcel->readActiveSheet($file_path);
echo "<table>";
foreach( $sheet_array as $row ) {
echo "<tr>";
foreach( $row as $column )
echo "<td>$column</td>";
echo "</tr>";
}
echo "</table>";
//or
//echo first cell of excel file
echo $sheet_array[1]['A'];
Having trouble installing
Hi,
I'm having trouble installing this extension. I opened a topic in the forum here. I'm excited to get this working. Thanks for any pointers!
Scott
How to overcome problems - solution:
In file yexcel/Yexcel.php change
from:
<?
to:
<?php
Then in file: yexel/Classes/PHPExcel/Autoloader.php starting in line 27 (just after initial comments) change
from:
to:
spl_autoload_unregister(array('YiiBase', 'autoload')); PHPExcel_Autoloader::Register(); spl_autoload_register(array('YiiBase', 'autoload'));
And enjoy your Excel files in Yii !
very good
niceeee
Thx
Works fine but i dont understand why you doesnt commit your changes ..
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.