ExcelDataSource
Introduction #
ExcelDataSource
help you to get data from your current Microsoft Excel file. Underline of ExcelDataSource
is the open-source library called PHPOffice/PhpSpreadsheet which helps us to read various Excel version. Please install the Excel package.
Settings #
Name | type | default | description |
---|---|---|---|
class | string | Must set to '\koolreport\datasources\ExcelDataSource' | |
filePath | string | The full file path to the Excel file. | |
firstRowData | boolean | false | Whether the first row is data. Normally the first row contain the field name so default value of this property is false. |
sheetName | string | null | Set the sheet name to read from |
sheetIndex | number | null | Set the sheet index to read from |
Example #
<?php
class MyReport extends \koolreport\KoolReport
{
public function settings()
{
return array(
"dataSources"=>array(
"excel_example_datasource"=>array(
"class"=>'\koolreport\excel\ExcelDataSource',
"filePath"=>"/var/storage/sales.xls",
),
)
);
}
public function setup()
{
$this->src('excel_example_datasource')
->pipe(..)
->pipe(...)
...
->pipe($this->dataStore('sales.excel'));
}
}
Get started with KoolReport
KoolReport will help you to construct good php data report by gathering your data from multiple sources, transforming them into valuable insights, and finally visualizing them in stunning charts and graphs.