1

Hello guys i have a problem reading a table from an Excel document that doesnt start from raw 1 colone 1 (A1) using LARAVEL, in this docuement there is a title and some empty rows, as the image show : Excel table image

here is the code that i have used to load a table from the document, meanwhile it works fine if i deleted all the title text and all the empty cells !

     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();
}
2
  • What extension or tool do you use to read excel files? Commented Jul 18, 2016 at 16:41
  • i'm using maatwebsite/excel Commented Jul 18, 2016 at 16:45

1 Answer 1

1

Yupiiii!! found a solution for this issue, by going to the config file : \laravel-Project\config\excel.php and change the following line:

  /*
    |--------------------------------------------------------------------------
    | 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,

and change the number 1 by whatever row your table start ^^ !

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.