Cell callback mode read
Maximum Memory = Maximum Cell Data Volume
This mode can satisfy xlsx large file reading

Function Prototype

1
nextCellCallback(callable $callback, string $sheetName = NULL): void
Copied!

Callback function prototype

1
function(int $row, int $cell, string|double|int $data)
Copied!

Single line end identifier

At the end of each line, callback call will be appended and pass XLSX_ROW_END to the end of the current line.

example

1
$config = ['path' => './tests'];
2
$excel = new \Vtiful\Kernel\Excel($config);
3
$filePath = $excel->fileName('tutorial.xlsx')
4
->header(['Item', 'Cost'])
5
->data([
6
['Item_1', 'Cost_1'],
7
])
8
->output();
9
10
$excel->openFile('tutorial.xlsx')->nextCellCallback(function ($row, $cell, $data) {
11
echo 'cell:' . $cell . ', row:' . $row . ', value:' . $data . PHP_EOL;
12
});
Copied!

Sample output

1
cell:0, row:0, value:Item
2
cell:1, row:0, value:Cost
3
cell:1, row:0, value:XLSX_ROW_END // end identifier
4
cell:0, row:1, value:Item_1
5
cell:1, row:1, value:Cost_1
6
cell:1, row:1, value:XLSX_ROW_END // end identifier
Copied!
Last modified 2yr ago