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

amitshrestha221's avatar

Laravel Nova, CSV Import issue

Hello everyone,

I am using using this plugin :

        "simonhamp/laravel-nova-csv-import": "0.3.0",

to import CSV in Nova.

I am getting this erorr upon uploading a csv file :

Sorry, we couldn't import that file.

Upon stack tracing, I find in UploadController:


 try {
            (new Importer)->toCollection($file, null);
        } catch (\Exception $e) {
            return response()->json(['result' => 'error', 'message' => 'Sorry, we could not import that file'], 422);
        }

Here the error is :



{
"result": "error",
"message": "foreach() argument must be of type array|object, null given"
} 


Anyone faced this issue earlier?

0 likes
1 reply
simonhamp's avatar

Hey @amitshrestha221 sorry to see you were having trouble using my package!

I don't typically monitor the Laracasts forum for questions about any of my open source work (I just happened to stumble across your post)

I appreciate this is a while ago now and you may have moved on from this problem, but if you're still experiencing this issue I'm happy to help

Please or to participate in this conversation.