BigSpreadsheetDataSource

Introduction #

In many case, data is stored in big CSV or spreadsheet files. The BigSpreadsheetDataSource in Excel package will help us to read data from those file and pipe their data into our processing chain.

Settings #

Nametypedefaultdescription
classstringMust set to '\koolreport\excel\BigSpreadsheetDataSource'
filePathstringThe full file path to the .csv file.
fileTypestringPossible values: "xlsx", "ods" or "csv", only needed if file extension is different from its type
fieldSeparatorstring","Set the field separator in your CSV file, some file use "\t" tab as field separator
charsetstring"utf8"Charset of your CSV or spreadsheet file
firstRowDatabooleanfalseWhether the first row is data. Normally the first row contain the field name so default value of this property is false.
sheetNamestringName of the sheet you want to read
sheetIndexnumberIndex of the sheet you want to read

Example #

<?php
class MyReport extends \koolreport\KoolReport
{
    public function settings()
    {
        return array(
            "dataSources"=>array(
                "big_csv"=>array(
                    "class"=>'\koolreport\excel\BigSpreadsheetDataSource',
                    "filePath"=>"/var/storage/big_sales.csv",
                    "fieldSeparator"=>"\t",
                ),
                "big_excel"=>array(
                    "class"=>'\koolreport\excel\BigSpreadsheetDataSource',
                    "filePath"=>"/var/storage/big_sales.xlsx",
                ),
            )
        );
    }
    public function setup()
    {
        $this->src('big_csv')
        ->pipe(..)
        ->pipe(...)
        ...
        ->pipe($this->dataStore('sales_csv'));

        $this->src('big_excel')
        ->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.