I used ToExcel (PHPExcel, EExcelView) to integrate excel data exports on my admin controller but have had some problem

with the controller hanging if the user does not filter the data

I got this to work pretty easily. Just used the $model on the first attempt. Later expanded the output array to include foreign keys for other tables. I think it is the foreign key fields that are slowing it down.

public function behaviors() {

	 	return array(






    public function actionExport() {

    	// Load data


      	$model = new Website('search');


  	// retrieve the search parameters from the session data

        $params = Yii::app()->user->getState('WebsiteSearchParams');

        if ( isset($params) )

                $model->attributes = $params;

        // retrieve the data by CActiveDataProvider     

	$dataProvider = $model->search();


	$data = $dataProvider->getData();


 	// Export it

    	$this-> toExcel( $data, 













	$dataProvider->modelClass, array('creator'=>Yii::app()->user->name ), 'Excel2007' );

	// 'Excel5' or  'Excel2007' or PDF


I am experiencing a slow response with 4 foreign key fields to tables for things like "status" or "category".

I have a problem when the user does not filter the data by at least one column, the controller seems to timeout and I am left with a blank page. Works fine if user selects all rows were status = ‘Active’ or any other column.

I only have 1500 rows in the table…so that data set is trivial in size. I am not a MySQL guy, but have 25 years of experience with designing Oracle applications. All my tables have primary keys and none of the tables used

for lookup are large (500 rows max, 10 rows average).

Any suggestions?


hi AustinGeek

I have little experience in yii framework, a recommendation would be to give you work that in seeking such procedures qeu tables are supported by MySql.

If you are referring to multiple tables from yii co I recommend working procedures.

In contrast, I have not been able to use the library or the method ToExcel. <_<