atishamte / piexl
phpexcel 库的 PHP 封装器
dev-master
2017-05-02 00:00 UTC
Requires
- php: >=5.6
- phpoffice/phpspreadsheet: dev-master
This package is not auto-updated.
Last update: 2024-09-15 01:30:20 UTC
README
将 PHP 导出至 Excel 或将 Excel 导入 PHP。用于生成 Excel 文件或加载 Excel 文件的 Excel 库。
安装
安装此扩展的首选方式是通过 Composer。
运行以下命令之一:
php composer.phar require --prefer-dist atishamte/piexl
OR
composer require atishamte/piexl
或者在您的 composer.json
文件的 require 部分添加:
"atishamte/piexl": "*"
to the require section of your composer.json
file.
使用方法
导入数据
导入 Excel 文件并返回到数组中。
<?php $config = [ 'fileNames' => 'SampleData.xlsx', // String or Array of file names 'setFirstRecordAsKeys' => true, // Set column keys as a index of each element 'setIndexSheetByName' => true, // Set worksheet name as a index of sheet data array 'getOnlySheet' => 'worksheetname', // Get data of particular worksheet 'getOnlySheetNames' => true, // Get only worksheet names as a array 'getSheetRangeInfo' => true, // Get range of filled cells in worksheets ]; $ExcelData = \atishamte\Piexl\Excel::import($config);