Search code examples
phpoffice

unable to load file from url phpoffice/spreadsheet


Trying to load an .xlsx file from url but it gives error like,

Fatal error: Uncaught InvalidArgumentException: File 
"http://localhost/test/csvfile/samplesms.xlsx" does not exist. in
D:\wamp\www\test\vendor\phpoffice\phpspreadsheet\src\PhpSpreadsheet\Shared\File.php on line 137

Loading file with below,

 $filename = "http://localhost/test/csvfile/samplesms.xlsx";
 $reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xlsx');
 $reader->setReadDataOnly(TRUE);
 $spreadsheet = $reader->load($filename);

File is already at given location.


Solution

  • loading from URL is not supported in phpoffice/spreadsheet.