如何使用Laravel从具有空行的Excel文档读取表格

你好家伙我有一个问题,阅读Excel文档中的一个表,从原始1 colone 1(A1)使用LARAVEL开始,在这个docuement中有一个标题和一些空行,如图所示: Excel表格图像

这里是我用来从文档加载表的代码,同时它工作正常,如果我删除所有的标题文本和所有的空单元格!

Excel::load(Input::file('file'), function($reader) { // Getting all results $results = $reader->get(); foreach ($results as $r =>$v) { $person = new Person; $person->name = $v['name']; $person->age = $v['age']; $person->save(); } 

Yupiiii! 通过转到configuration文件find一个解决scheme: \ laravel-Project \ config \ excel.php并更改以下行:

  /* |-------------------------------------------------------------------------- | First Row with data or heading of data |-------------------------------------------------------------------------- | | If the heading row is not the first row, or the data doesn't start | on the first row, here you can change the start row. | */ 'startRow' => 1, 

并改变数字1,无论你的表开始^^!