Laravel-excel: [QUESTION] Setting CSV Header "startRow" dynamically?

Created on 5 Jan 2017  路  2Comments  路  Source: Maatwebsite/Laravel-Excel

Hi guys, I have a situation where I'm processing a few CSV files as background jobs and on one of the files, the headers are actually on Line 4.

I know I can change the startRow in the config, however, I only need it changed for one particular file. Is there anyway to set this as part of Excel::load() or anything?

Any help would be much appreciated.

Most helpful comment

Found a way round this by setting config dynamically before calling Excel::load():

config(['excel.import.startRow' => 4]);

All 2 comments

Found a way round this by setting config dynamically before calling Excel::load():

config(['excel.import.startRow' => 4]);

After pulling my hair out for a couple of hours, with laravel 4.2 and trying to get this to work, I poured over the source code and in case it helps someone:

Config::set('excel::import.startRow', 4);

does the trick; notice the :: instead of .

Was this page helpful?
0 / 5 - 0 ratings

Related issues

octoxan picture octoxan  路  3Comments

disto picture disto  路  3Comments

amine8ghandi8amine picture amine8ghandi8amine  路  3Comments

rossjcooper picture rossjcooper  路  3Comments

pamekar picture pamekar  路  3Comments