大家好我从Excel文档读取表格时遇到问题,该文档不使用LARAVEL从raw 1 colone 1(A1)开始,在此docuement中有一个标题和一些空行,如图所示:{{3 }}
这里是我用来从文档中加载表格的代码,同时如果我删除了所有标题文本和所有空单元格,它的工作正常!
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();
}
答案 0 :(得分:1)
Yupiiii !!通过转到配置文件找到了解决此问题的方法: 的 \ laravel-项目\配置\ 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 ^^!