phpoffice/phpspreadsheet library
- Add
phpoffice/phpspreadsheet
library tocomposer.json
file:
"require": {
"phpoffice/phpspreadsheet": "^1.14"
}
- Install library from the command line:
composer install
- Read data from MS Excel (XLSX) file:
<?php
use PhpOffice\PhpSpreadsheet\IOFactory;
require_once __DIR__.'/vendor/autoload.php';
$spreadsheet = IOFactory::load('test.xlsx');
$sheet = $spreadsheet->getActiveSheet();
$data = $sheet->toArray();
print_r($data);
Leave a Comment
Cancel reply