最近接到个新需求:导出一个包含多个sheet的Excel文件。
本打算用PHPExcel,然后查了一下 发现PHPExcel已经不再维护,PhpSpreadsheet是PHPExcel的下一个版本,那么暂时就用它实现新需求吧。
Composer安装: composer require phpoffice/phpspreadsheet
D:\Sites>composer require phpoffice/phpspreadsheet Using version ^1.8 for phpoffice/phpspreadsheet ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 4 installs, 0 updates, 0 removals - Installing markbaker/matrix (1.2.0): Loading from cache - Installing markbaker/complex (1.4.7): Loading from cache - Installing psr/simple-cache (1.0.1): Loading from cache - Installing phpoffice/phpspreadsheet (1.8.2): Loading from cache phpoffice/phpspreadsheet suggests installing mpdf/mpdf (Option for rendering PDF with PDF Writer) phpoffice/phpspreadsheet suggests installing dompdf/dompdf (Option for rendering PDF with PDF Writer) phpoffice/phpspreadsheet suggests installing tecnickcom/tcpdf (Option for rendering PDF with PDF Writer) phpoffice/phpspreadsheet suggests installing jpgraph/jpgraph (Option for rendering charts, or including charts with PDF or HTML Writers) Package yiisoft/yii2-codeception is abandoned, you should avoid using it. Use codeception/codeception instead. Writing lock file Generating autoload files