0

I am trying to read an excel file from server. I want to get the data and turn it into an array.

Earlier I tried converting excel into an array and I succeeded. I used the following code.

$data = Excel::toArray(new Import, request('file') , 'public');

My import Class was

class Import implements ToModel,WithCalculatedFormulas
{
    use Importable;
    /**
    * @param Collection $collection
    */
    public function model(array $row)
    {

    }
}

And it was working perfectly. Now instead of submitting the file by a form; I need to read it from server. So I changed the code to,

$data = Excel::toArray(new Import, $file_url , 'public');

But now it is giving me error like below. (I changed the url to post here)

File not found at path: http:/XXXX.YYY.com/temp_upload/1581488988_test.xlsx

I checked my server. The file is indeed there. Even, when I try to browse the URL it is downloading the correct file. But it isn't being read.

Nabil Farhan
  • 1,444
  • 3
  • 25
  • 41

0 Answers0