PHPackages                             fan1992/phpspreadsheet - 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. fan1992/phpspreadsheet

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

fan1992/phpspreadsheet
======================

phpspreadsheet

0.5.0(6y ago)110[1 PRs](https://github.com/fan1992/phpspreadsheet/pulls)MITPHP

Since Jun 20Pushed 5y agoCompare

[ Source](https://github.com/fan1992/phpspreadsheet)[ Packagist](https://packagist.org/packages/fan1992/phpspreadsheet)[ RSS](/packages/fan1992-phpspreadsheet/feed)WikiDiscussions master Synced 2w ago

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

phpspreadshhet
==============

[](#phpspreadshhet)

phpspreadshhet 读取，导出

安装
==

[](#安装)

```
    composer require fan1992/phpspreadsheet

```

使用示例
====

[](#使用示例)

```
    use Fan1992\Phpspreadsheet\Excel;
    $excel = new Excel();

```

读取文档（默认只读取第一个sheet）
===================

[](#读取文档默认只读取第一个sheet)

```
    $data = $excel->read('./test.xlsx');
    print_r($data);

```

一次读取多个sheet
===========

[](#一次读取多个sheet)

```
    $excel->sheetNames = ['data_a'=>'表1','data_b'=>'表2','data_c'=>'Sheet3'];
    $data = $excel->read('./test.xlsx');
    print_r($data);

```

一次读取所有sheet
===========

[](#一次读取所有sheet)

```
    $excel = new Excel();
    $excel->autoReadAllSheets = true;
    $data = $excel->read('./test.xlsx');
    print_r($data);

```

导出
==

[](#导出)

```
    $header = ['提提1', 'title2', '标题3', '测试测试']; //表头，即第一行
    $data = [//具体数据，支持多维数组（合并单元格）
        ['12', ['阿斯顿发','asdf','2019-06-19'], '是的', '沙箱'],
        ['撒发顺丰的', ['1','23','撒旦法师'], '2019-06-19', 'asdasdfas']
    ];
    $width = [30,0,40,60]; //列宽度，为0或没有则自动适应
    $excel->export($data, $header,'test'.time(),null, 'mysheet', $width);

```

导出多个sheet
=========

[](#导出多个sheet)

```
    $excel1Data = [
        'data'      => [
            ['12', ['阿斯顿发', 'asdf', '2019-06-19'], '是的', '沙箱'],
            ['asd', ['阿斯顿发', '22', '2019-06-19'], '是', '沙asdf箱'],
        ],
        'header'    => ['header1', '标题2', '333', '超级长超级长超级长超级长超级长超级长超级长的标题'],
        'sheetName' => '1211sheet1',
        'width'     => [5, 0, 5]
    ];
    $excel2Data = [
        'data'      => [
            ['12', ['阿斯顿发', 'asdf', '2019-06-19'], '是的', '沙箱'],
            ['asd', ['阿斯顿发', '22', '2019-06-19'], '是', '沙asdf箱'],
        ],
        'header'    => ['header1', '标题2', '333', '超级长超222222级长超级长超级长超级长超级长超级长的标题'],
        'sheetName' => '',
        'width'     => []
    ];
    $excel3Data = [
        'data'      => [
            ['12', ['阿斯顿发', 'asdf', '2019-06-19'], '是的', '沙333箱'],
            ['asd', ['阿斯顿发', '22', '2019-06-19'], '是3333', '沙asdf箱'],
        ],
        'header'    => ['header1', '标题2', '333', '超级长超级长超3333级长超级长超级长超级长超级长的标题'],
        'sheetName' => '导出sheet3',
        'width'     => []
    ];
    $data       = [$excel1Data, $excel2Data, $excel3Data];
    $excel->mutiSheetExport($data, 'muti' . time(), Sheet::TYPE_XLSX);

```

其它
==

[](#其它)

```
    $readFirstLine = false;//是否读取首行
    $down = true; //是否直接下载，false则保存文件在服务器上

    支持导出格式：xls，xlsx

```

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~333 days

Total

2

Last Release

2233d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/88980915?v=4)[fan1992](/maintainers/fan1992)[@fan1992](https://github.com/fan1992)

---

Top Contributors

[![fbenwu](https://avatars.githubusercontent.com/u/24912844?v=4)](https://github.com/fbenwu "fbenwu (12 commits)")

---

Tags

excelphpphpspreadsheet

### Embed Badge

![Health badge](/badges/fan1992-phpspreadsheet/health.svg)

```
[![Health](https://phpackages.com/badges/fan1992-phpspreadsheet/health.svg)](https://phpackages.com/packages/fan1992-phpspreadsheet)
```

###  Alternatives

[maatwebsite/excel

Supercharged Excel exports and imports in Laravel

12.7k152.8M851](/packages/maatwebsite-excel)[craftcms/cms

Craft CMS

3.6k3.6M2.9k](/packages/craftcms-cms)[bfinlay/laravel-excel-seeder

Seed the database with Laravel using Excel, XLSX, XLS, CSV, ODS, Gnumeric, XML, HTML, SLK files

3946.2k](/packages/bfinlay-laravel-excel-seeder)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1615.6k12](/packages/2lenet-crudit-bundle)[bedita/manager

BEdita Manager - official admin webapp for BEdita4 API

131.1k](/packages/bedita-manager)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
