cyber-duck / laravel-excel导入没有标题的xlsx,xls,csv数据?

时间:2019-11-22 02:31:21

标签: php laravel cyberduck

目前我有laravel v5.8.**,并且有cyber-duck/laravel-excel

在我的controller中,我有此工作代码

    $excel = Importer::make('Excel');
    $excel->load($savePath.$fileName);
    $collection = $excel->getCollection();

    if(sizeof($collection[1]) == 5)
    {
        return $collection;
    }
    else
    {
        return redirect()
        ->back()
        ->with(['errors'=> [0=> 'Please provide date in file according to your format.']])
        ->with('modal',$modal);
    }

这是我的excel

的当前数据

enter image description here

当前输出为

[["id","username","name","email","birthdate"],[1,"j.doe17","Jun Doe","j.doe@gmail.com",{"date":"1996-09-07 00:00:00.000000","timezone_type":3,"timezone":"Asia\/Taipei"}],[2,"j.doe18","Jan Doe","jan.doe@gmail.com",{"date":"1996-09-07 00:00:00.000000","timezone_type":3,"timezone":"Asia\/Taipei"}]]

是否可以只获取没有headings/fields的记录?

因为我将尝试将这些数据保存到我的数据库中

0 个答案:

没有答案
相关问题