vendredi 19 juillet 2019

unable to dumb all foreach values in csv export in laravel

I am trying to export some data stored in an array to a CSV, well I have stored the values in an array, changed the array into a collection and then applied a for-each to get all the values but it only returns one value.

I have also tried simple array with and without for each but in that case it returns empty sheet

$arrays = explode(PHP_EOL, $files);
        //$arrays = $files;
        //dd($arrays);
        foreach ($arrays as $file) {


                $array=collect([
                    [  'asins' =>$file ]

                ]);}
        /*        foreach ($arrays as $file) {
                     echo $file.'<br>';
                }*/
            return (new FastExcel($array))->export('file.xlsx');

I expect all the values to be exported into the CSV in separate columns



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire