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 #
Name | type | default | description |
---|---|---|---|
class | string | Must set to '\koolreport\excel\BigSpreadsheetDataSource' | |
filePath | string | The full file path to the .csv file. | |
fileType | string | Possible values: "xlsx", "ods" or "csv", only needed if file extension is different from its type | |
fieldSeparator | string | "," | Set the field separator in your CSV file, some file use "\t" tab as field separator |
charset | string | "utf8" | Charset of your CSV or spreadsheet 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 | Name of the sheet you want to read | |
sheetIndex | number | Index 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.