valentinloiseau / excel-data-extractor
Excel Data Extractor crawl an Excel file and extracts the header and data of a table inside.
v0.1.1
2019-12-23 17:54 UTC
Requires
- php: ^7.2
- phpoffice/phpspreadsheet: ^1.10
This package is auto-updated.
Last update: 2024-09-22 20:26:28 UTC
README
Excel Data Extractor crawl an Excel file and extracts the header and data of a table inside.
Installation
$ composer require valentinloiseau/excel-data-extractor
Usage
$crawler = new Crawler('path/to/my/file.xlsx'); # Make some adjustments Configuration::setLineAttributesFromHeader(true); $table = $crawler->getTable(); $headers = $table->getHeaders(); $lines = $table->getLines();
Configuration
Call the following static methods to class Configuration
:
setIgnoreBlankLines
Default to true
.
Set to false
to get all table lines, included blank lines.
setLineAttributesFromHeader
Default to false
.
By default, cell values are stored in the corresponding string column index property, eg: if the first cell value of current line if 'bar' the result will be 'A' => 'bar'
.
For the same example if this configuration is set to true
and the guessed column name is 'foo' the result will be 'foo' => 'bar'
.