Get started

Get data from Excel #

ExcelDataSource help you to get data from your current Microsoft Excel file.

Settings #

Nametypedefaultdescription
classstringMust set to '\koolreport\datasources\ExcelDataSource'
filePathstringThe full file path to your Excel file.
charsetstring"utf8"Charset of your 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 a sheet name to load instead of all sheets. (version >= 2.1.0)
sheetIndexnumbernullSet a sheet index to load instead of all sheets. If both sheetName and sheetIndex are set, priority is given to sheetName first. (version >= 2.1.0)

Example #

class MyReport extends \koolreport\KoolReport
{
    public function settings()
    {
        return array(
            "dataSources"=>array(
                "sale_source"=>array(
                    "class"=>"\koolreport\excel\ExcelDataSource",
                    "filePath"=>"../data/my_file.xlsx",
                    "charset"=>"utf8",
                    "firstRowData"=>false,//Set true if first row is data and not the header,
                    "sheetName"=>"sheet1", // (version >= 2.1.0)
                    "sheetIndex"=>0, // (version >= 2.1.0)
                )
            )
        );
    }

    public function setup()
    {
        $this->src('sale_source')
        ->pipe(...)
    }
}