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 #

Nametypedefaultdescription
classstringMust set to '\koolreport\datasources\ExcelDataSource'
filePathstringThe full file path to the Excel file.
firstRowDatabooleanfalseWhether the first row is data. Normally the first row contain the field name so default value of this property is false.
sheetNamestringnullSet the sheet name to read from
sheetIndexnumbernullSet 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.