Van1310
5 months ago

import csv file without header lines how it work?

Posted 5 months ago by Van1310

$path=Input::file('import_file')->getRealPath();

$data=Excel::load($path, function($reader){

})->get();

if(!empty($data) && $data->count())
    
{
        
    foreach($data as $key=>$value)
        
    {
            
        $data=$data->toArray();
            
        for($i=0;$i<count($data);$i++)
                {
    
                        $dataImported[]=$data[$i];
            
        }        
                
        Import::insert($dataImported);
            

return \Redirect::Back(); } }

Please sign in or create an account to participate in this conversation.