I have a project where I'm using Laravel Excel to import a spreadsheet, this aspect is completely fine.
If I download a file from the internet to my downloads folder and then try to import that file, I get an empty array [ ]. When I open the file in Excel it says that it is open in protected view. If I then enable editing and resave this file it then becomes readable.
To replicate my issue you can do the following:
- Download an Excel file from an external source to a Windows machine
- Attempt to import the file like so $importData = (new CustodianUsersImport)->toArray($request->file('upload'));
- Die and dump $importData, it should be null.
- Open the file in Excel, disable protected view and resave it
- Attempt to re-import. The dd() should contain an array.
My question is, is it possible to remove the protection before reading?