Support the ongoing development of Laravel.io →
posted 8 years ago
Packages

hi,

I want to import a excel file.

So in controller i do :

$reader=Excel::load('storage/app/uploads/Catalogue.xlsx', function($reader) {
        });
        // Getting all results
        $results = $reader->get();

            // reader methods

            return view('catalogue', compact('results'));

And in blade.php :

 @foreach ($results as $result)
                            <tr>
                                    <td>{{$result}}</td>
                            </tr>
                        @endforeach

But the result is a collection :

{"chateau":"ANGELUS","appellation":"Saint Emilion","class":"1GCCB","mil":1981,"cl":75,"cond":"Unit.","qte":1,"regie":"Acquit","prix_unit_ht":"160,00 \u20ac"}

So, how to access to the value ?

Ex : "ANGELUS","Saint Emilion","1GCCB",1981,75,"Unit.",1,"Acquit","160,00 \u20ac"

Thanks

Last updated 3 years ago.
0
@foreach ($results as $rows)

                            <tr><td>
                                @foreach ($rows as $cell)
                                    {{$cell}}
                                @endforeach</td>
                            </tr>

                        @endforeach
Last updated 8 years ago.
0

Sign in to participate in this thread!

PHPverse

Your banner here too?

guil182 guil182 Joined 1 Jul 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.