PHPackages                             pocketframe/excel - 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. pocketframe/excel

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

pocketframe/excel
=================

A Pocketframe package for Excel/CSV import and export built on PhpSpreadsheet with support for styling, multiple sheets, and chunked processing.

1.0.1(1y ago)07MITPHPPHP ^8.1

Since Apr 13Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Pocketframe/excel)[ Packagist](https://packagist.org/packages/pocketframe/excel)[ RSS](/packages/pocketframe-excel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (4)Used By (0)

Pocketframe Excel
=================

[](#pocketframe-excel)

A robust Pocketframe package for Excel and CSV import/export built on PhpSpreadsheet. It supports advanced features such as cell styling, multiple sheets, chunked processing for very large files, and auto-detection of CSV files.

Features
--------

[](#features)

- **Auto-detection of file type:**Process Excel (.xlsx, .xls) and CSV files seamlessly.
- **Chunked Reading:**Use a custom ChunkReadFilter to limit memory usage by processing files in defined row chunks.
- **Advanced Export Options:**Apply cell formatting and styling, create multi-sheet exports, and handle complex excel features like merged cells and formulas.
- **Easy to Use API:**The package exposes a clean, static-style API through the Excel Mask that integrates with Pocketframe’s Storage, DataSet, and Response systems.
- **Extensible:**Use standard contracts for custom importer and exporter classes.

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

[](#installation)

Install via Composer:

```
composer require pocketframe/excel
```

Usage
-----

[](#usage)

### Importing Data

[](#importing-data)

Generating an importer by running the following command:

```
php pocket excel:create:importer Users
```

Important

You should not add Importer or Import to the file name. This will be added automatically and the file name will become `UsersImporter.php`. If you add Importer or Import to the file name will now become `UsersImporterImporter.php` which may not look nice. This also applies to the exporters.

This will generate a file named UsersImporter.php in the `app/Excel/Imports` directory. You can then customize the file accordingly.

Note

You can pass an entity name to the command to generate an importer for that entity. For example, `php pocket excel:create:importer Users --entity=User` will generate an importer for the User entity.

**Create an importer by implementing**

`Pocketframe\Excel\Contracts\ImporterInterface`. For example, create a file at `app/Excel/Imports/UsersImporter.php` with the following content:

```
