PHPackages                             queencitycodefactory/cakespreadsheet - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PDF &amp; Document Generation](/categories/documents)
4. /
5. queencitycodefactory/cakespreadsheet

ActiveCakephp-plugin[PDF &amp; Document Generation](/categories/documents)

queencitycodefactory/cakespreadsheet
====================================

CakePHP 3 PHP Spreadsheet

3.9.1(3y ago)224.9kMITPHPPHP &gt;=7.2.0

Since Feb 25Pushed 2mo ago9 watchersCompare

[ Source](https://github.com/QueenCityCodeFactory/CakeSpreadsheet)[ Packagist](https://packagist.org/packages/queencitycodefactory/cakespreadsheet)[ Docs](https://github.com/QueenCityCodeFactory/CakeSpreadsheet.git)[ RSS](/packages/queencitycodefactory-cakespreadsheet/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (3)Dependencies (4)Versions (7)Used By (0)

CakeSpreadsheet
===============

[](#cakespreadsheet)

CakeSpreadsheet is a CakePHP 3.x plugin for generating Excel Files in the xlsx format using PHPOffice/PhpSpreadsheet.

Requirements
------------

[](#requirements)

- CakePHP 3.x
- PHP 7.2

Installation
------------

[](#installation)

*\[Using [Composer](http://getcomposer.org/)\]*

```
composer require queencitycodefactory/cakespreadsheet

```

### Enable plugin

[](#enable-plugin)

Load the plugin in your app's `config/bootstrap.php` file:

```
Plugin::load('CakeSpreadsheet', ['bootstrap' => true, 'routes' => true]);
```

Usage
-----

[](#usage)

First, you'll want to setup extension parsing for the `xlsx` extension. To do so, you will need to add the following to your `config/routes.php` file:

```
// Set this before you specify any routes
Router::extensions('xlsx');
```

Next, we'll need to add a viewClassMap entry to your Controller. You can place the following in your AppController:

```
public $components = [
    'RequestHandler' => [
        'viewClassMap' => [
            'xlsx' => 'CakeSpreadsheet.Spreadsheet',
        ],
    ]
];
```

Each application *must* have an xlsx layout. The following is a simple layout that can be placed in `src/Template/Layout/xlsx/default.ctp`:

```
