I have this code but for some reason i can’t read the xls correctly..
The path is correct but i have got this error..
Someone can help me?
namespace AppHttpControllers;
use IlluminateHttpRequest;
use IlluminateSupportFacadesStorage;
class CTTFileProcessor extends Controller
{
public function process(Request $request)
{
//$file = Storage::disk(‘public’)->path(‘Discriminativo.xls’);
$filePath = str_replace(”, ‘/’, Storage::disk(‘public’)->path(‘Discriminativo.xls’));
$reader = new PhpOfficePhpSpreadsheetReaderXls();
$reader->setReadDataOnly(true);
$spreadsheet = $reader->load($filePath);
$worksheet = $spreadsheet->getActiveSheet();
$data = $worksheet->toArray();
dd($data);
exit;
}
}
Rúben Santos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.