Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rocky114/spreadsheet
Read and write spreadsheet files (CSV, XLSX )
https://github.com/rocky114/spreadsheet
csv csv-export csv-import excel-export excel-import php php7 spreadsheet xlsx
Last synced: 8 days ago
JSON representation
Read and write spreadsheet files (CSV, XLSX )
- Host: GitHub
- URL: https://github.com/rocky114/spreadsheet
- Owner: rocky114
- License: mit
- Created: 2020-01-08T08:14:12.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-08-07T15:31:58.000Z (over 3 years ago)
- Last Synced: 2024-09-09T17:11:26.624Z (3 months ago)
- Topics: csv, csv-export, csv-import, excel-export, excel-import, php, php7, spreadsheet, xlsx
- Language: PHP
- Homepage:
- Size: 270 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# EXCEL
this is a PHP library to read and write spreadsheet files (CSV, XLSX), in a fast and scalable way.
## Requirements
* PHP version 7.1 or higher
* PHP extension `php_zip` enabled
* PHP extension `php_xmlreader` enabled## Tips
If you have any ideas, please contact me and I will try to achieve## Writer example
```
include "./vendor/autoload.php";$writer = \Rocky114\Excel\Writer\WriterFactory::createXLSXWriter();
$writer->setTempFolder('.');$writer->addNewSheet('sheet1');
$type = [
'A' => 'string',
'B' => '#,##0'
];
$writer->addHeader(['name', 'id'], $type)->addRow(['xinzhu', 1234565])->addRow(['rocky', 21])->save();
```## Reader example
```
include "./vendor/autoload.php";$reader = \Rocky114\Spreadsheet\ReaderFactory::createReaderFromFile('./test.xlsx');
$data = [];
foreach ($reader->getSheetIterator() as $sheet) {
foreach ($sheet->getRowIterator() as $row) {
$data[] = $row;
}
}// or
$data = $reader->getSheet()->load();
```