

GitHub - PHPOffice/PhpSpreadsheet: A pure PHP library for reading and writing sp...
source link: https://github.com/PHPOffice/PhpSpreadsheet
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

PhpSpreadsheet
PhpSpreadsheet is a library written in pure PHP and offers a set of classes that allow you to read and write various spreadsheet file formats such as Excel and LibreOffice Calc.
PHP version support
LTS: Support for PHP versions will only be maintained for a period of six months beyond the end of life of that PHP version.
Currently the required PHP minimum version is PHP 7.3.
See the composer.json
for other requirements.
Installation
Use composer to install PhpSpreadsheet into your project:
composer require phpoffice/phpspreadsheet
If you are building your installation on a development machine that is on a different PHP version to the server where it will be deployed, or if your PHP CLI version is not the same as your run-time such as php-fpm
or Apache's mod_php
, then you might want to add the following to your composer.json
before installing:
{
"require": {
"phpoffice/phpspreadsheet": "^1.23"
},
"config": {
"platform": {
"php": "7.3"
}
}
}
and then run
composer install
to ensure that the correct dependencies are retrieved to match your deployment environment.
See CLI vs Application run-time for more details.
Additional Installation Options
If you want to write to PDF, or to include Charts when you write to HTML or PDF, then you will need to install additional libraries:
For PDF Generation, you can install any of the following, and then configure PhpSpreadsheet to indicate which library you are going to use:
- mpdf/mpdf
- dompdf/dompdf
- tecnickcom/tcpdf
and configure PhpSpreadsheet using:
// Dompdf, Mpdf or Tcpdf (as appropriate)
$className = \PhpOffice\PhpSpreadsheet\Writer\Pdf\Dompdf::class;
IOFactory::registerWriter('Pdf', $className);
or the appropriate PDF Writer wrapper for the library that you have chosen to install.
Chart Export
For Chart export, we support following packages, which you will also need to install yourself using composer require
- jpgraph/jpgraph (this package was abandoned at version 4.0. You can manually download the latest version that supports PHP 8 and above from jpgraph.net)
- mitoteam/jpgraph (fork with php 8.1 support)
and then configure PhpSpreadsheet using:
Settings::setChartRenderer(\PhpOffice\PhpSpreadsheet\Chart\Renderer\JpGraph::class); // to use jpgraph/jpgraph
//or
Settings::setChartRenderer(\PhpOffice\PhpSpreadsheet\Chart\Renderer\MtJpGraphRenderer::class); // to use mitoteam/jpgraph
One or the other of these libraries is necessary if you want to generate HTML or PDF files that include charts.
Documentation
Read more about it, including install instructions, in the official documentation. Or check out the API documentation.
Please ask your support questions on StackOverflow, or have a quick chat on Gitter.
PHPExcel vs PhpSpreadsheet ?
PhpSpreadsheet is the next version of PHPExcel. It breaks compatibility to dramatically improve the code base quality (namespaces, PSR compliance, use of latest PHP language features, etc.).
Because all efforts have shifted to PhpSpreadsheet, PHPExcel will no longer be maintained. All contributions for PHPExcel, patches and new features, should target PhpSpreadsheet master
branch.
Do you need to migrate? There is an automated tool for that.
License
PhpSpreadsheet is licensed under MIT.
Recommend
-
117
1.8 Go to file Code ...
-
103
README.md ...
-
234
使用PhpSpreadsheet读取和写入Excel 2018年06月07日 22:25 helloweba.net 作者:月光光 标签:PHP
-
70
老板说他懒得去登录平台查看数据报表,他想每天给他推送Excel数据表格。面对这样的需求,开发者要蛋定。其实老板的需求实现起来很简单,我今天给大家介绍如何使用PhpSpreadsheet将学生成绩数据导出为Excel文件。
-
171
README.md PHPSpreadsheet Helper PHP Excel Helper - Write and read Spreadsheet with easy way based on PhpSpreadsheet
-
21
phpspreadsheet内存优化节省内存: https://phpspreadsheet.readthedocs.io/en/latest/topics/memory_saving/#memory-saving这里我们使用
-
7
PhpSpreadsheet的简单使用 - kk Blog —— 通用基础kk Blog —— 通用基础 date [-d @int|str] [+%s|"+%F %T"]
-
14
Excelize Introduction Excelize is a library written in pure Go providing a set of functions that allow you to write to and read from XLSX / XLSM / XLTM / XLTX files. Supports reading and writing spreadsheet documents generat...
-
3
PhpSpreadsheet 读取xls文件 3:06:30 自动转换为浮点数float 0.12663194444444 问题
-
8
go-nbd
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK