Import Excel file to Laravel Project.

Posted 3 months ago by Vishaal


I have create an project with laravel for import excel files inside mysql database. The problem what i getting is import date and time inside mysql.

I'm getting the follow error code: Invalid datetime format: 1292 Incorrect date value: '43557' for column 'date' at row 1

I'm using for the import.

The Code of controller is:

public function import() 
        Excel::import(new JobsImport,request()->file('file'));
        return back();

Code of Class

    public function model(array $row)

        return new ImportJob([
            'colm1'           => $row[0],
            'colm2'               => $row[1],
            'colm3'            => $row[2],
            'colm4'                  => $row[3],
            'colm5'              => $row[4],
            'colm6'              => $row[5],
            'colm7'                  => $row[6],
            'colm8'                  => $row[7],
            'colm9'             => $row[8],
            'colm10'              => $row[9],
            'colm11'           => $row[10],
            'colm12'   => $row[11],
            'colm13'               => $row[12],
            'colm14'          => $row[13],
            'colm15'                => $row[14],

Excel file have simple lines:

Geen 1 dummy Nederlands Ja Geen 2019-04-02 Centraal 3:00:00 PM 6:00:00 PM H1.03 10 dfj jaja aanvragerpending

Do anyone have a solution to get this solve?

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