Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

eludic's avatar

A non well formed numeric value encountered -- Laravel Excel

I am seeing this error for dates when importing the excel file into application. I know excel stores dates in a numeric value which is imported by Laravel Excel. I have added a validation to check if the field is numeric, if not show an error to confirm the field is set as date.

However I am still seeing this error. Any ideas?

0 likes
2 replies
Sinnbeck's avatar

This is how I handle date in imports

private function getDate(array $row)
    {
        $date = $row['date'] ??  null;

        if (is_null($date)) {
            return null;
        }

        if (is_numeric($date)) {
            $date = ($date - 25569) * 86400;

        }

        return Carbon::parse($date)->toDateString();
    }
1 like

Please or to participate in this conversation.