How to import xlsx file and convert to array using Maatwebsite\Excel
in Maatwebsite\Excel using
how to convert xlsx file to convert to array
my question is i have a excel file and its data to be a array
$collection = Excel::toArray(new SectorFileImport, $path);
but the header also consider as an array also in my excel contains only 16 rows one is header but array returns as 1024
use App\User;
use Maatwebsite\Excel\Concerns\ToModel;
use Maatwebsite\Excel\Concerns\WithHeadingRow;
class UsersImport implements ToModel, WithHeadingRow
{
public function model(array $row)
{
return new User([
'name' => $row['name'],
'email' => $row['email'],
'at' => $row['at_field'],
]);
}
}