PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, January 26, 2022

[FIXED] Laravel excell skip rows when reading data using maatwebsite/excel

 January 26, 2022     laravel, laravel-5, php     No comments   

Issue

I am using maatwebsite/excel to read data and I would like to skip the first two rows.

Reading data:

$data = Excel::load('storage/app/temporary'.'/'.$request->input('file'))->get();
return $data;

The above code returns all the rows

How do I skip the first two rows?


Solution

Or you could use limit()

$data = Excel::load('storage/app/temporary'.'/'.$request->input('file'))-->limit(false, 2)->get();
return $data;

Or try adding this line before read-

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

this was answered here, you can see this link to have a better understanding.



Answered By - Sohel0415
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing