Yii 1.1: yexcel

Excel file reader for Yii Framework
16 followers

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'];

Resources

Total 4 comments

#13652 report it
DrMabuse at 2013/06/14 05:49am
Thx

Works fine but i dont understand why you doesnt commit your changes ..

#11649 report it
syrakozz at 2013/01/24 04:58pm
very good

niceeee

#11509 report it
Ziggi at 2013/01/17 03:43pm
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:

PHPExcel_Autoloader::Register();

to:

spl_autoload_unregister(array('YiiBase', 'autoload'));
PHPExcel_Autoloader::Register();
spl_autoload_register(array('YiiBase', 'autoload'));

And enjoy your Excel files in Yii !

#10576 report it
scallas at 2012/11/05 04:40pm
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

Leave a comment

Please to leave your comment.

Create extension
Downloads