I am dealing with large excel file for amazon product.
Here importing file, collection attributes consider as a first row alway, but in some case first raw may be description, title of image. So we must ignore it for expected result.

And this gives me wrong result as below

So how can i use manual row as a header of data ?
You can change the startrow in the import config
Ok thanks
But is there any way to change config on fly.
Because if i have two excel, first has first row as a header & second has second so.
Use Config::set()
Use Config::set()
can you give an example with parameters?
It would be something like this:
Config::set('excel.import.startRow', $headerRowNumber);
Probably, you will have to add the Config class to get this working by adding use Config; to your file too.
L4.2 docs about "Configuration" mention these only and works with L5 too.
You can actually call LaravelExcelReader's method setHeaderRow(). According to my tests you have to call it before loading your xlsx file.
Example:
$reader->setHeaderRow(3);
$reader->load('myfile.xlsx');
Please note that if you chunk-read the file the column mapping will fail.
hey, I have the same issue. I'm using chunk function and set startRow before load the file, but the start row always from row 1. here is my code:
\Config::set('excel.import.startRow', 2);
Excel::filter('chunk')
->load($dataSource)
->chunk(100, function($results) use ($log)
Hi nurwin, you can resolve? I have the same issue and i can't resolve it.
Most helpful comment
can you give an example with parameters?