ondics/yii1spreadsheet Yii1 extension for export to a spreadsheet, e.g. Excel, LibreOffice etc.

Yii1 Spreadsheet Extensions

  1. Installation
  2. Usage
  3. Application Notes
  4. Credits
  5. Author

Provides very easy Excel-Output for Yii1

  • works with CArrayDataProvider
  • works with CActiveDataProvider
  • provides flexible value formatting with PHP closures (see below)

This extension was built because the extension phpoffice/phpexcel is marked as "archived/abandoned" and there was no Yii1 extension as successor to use the recommended PhpSpreadsheet library.

Tested with Yii1 version 1.1.25


The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist ondics/yii1spreadsheet

or add

"ondics/spreadsheet": "*"

to the require section of your composer.json.


$dataProvider = new CArrayDataProvider([
        'name' => 'some name',
        'price' => '9879',
        'name' => 'name 2',
        'price' => '79',
$exporter = new Spreadsheet();
$exporter->dataProvider = $dataProvider;
$exporter->columns = [
        'attribute' => 'price',
        'header' => 'Price with VAT',
        'value' => function($model,$key,$index,$x) {
            return $model->price * 1.19;
          'visible' => ($model->price  > 20),

Application Notes

This yii1 extension is a light backport of https://github.com/yii2tech/spreadsheet to Yii1. Some Yii2 base classes and features are required and thus provided with this extensions and can be used during Excel export, e.g.

  • In colums a closure can be used as value. This closue differs from the closure in Yii1. See the example above how to use this closure.
  • The columns array is backported from Yii2 so see Yii2 docs for information

The send method cannot not use xsendfile to send a file directyle to the browser but has go over memory. This may affect very large Excel exports.


Thanks to https://patreon.com/klimov_paul and yii2tech which provide https://github.com/yii2tech/spreadsheet



(C) 2022, Ondics GmbH

1 0
1 follower
Yii Version: 1.1
License: BSD-3-Clause
Category: Others
Developed by: Ondics
Created on: Feb 25, 2022
Last updated: (not set)
Packagist Profile
Github Repository

Related Extensions