spout icon indicating copy to clipboard operation
spout copied to clipboard

IOException, failed to open stream: operation failed

Open DVendy opened this issue 11 years ago • 8 comments

I keep on getting this error?, why?? I wrote exactly as in the document...

IOException in AbstractReader.php line 90: Could not open lol.xlsx for reading! (XMLReader::open(zip://lol.xlsx#xl\sharedStrings.xml): failed to open stream: operation failed)

DVendy avatar May 13 '15 09:05 DVendy

Hi @DVendy, Can you try 2 things to narrow down the issue?

  1. Change the location of the XLSX to make sure it can still be read
  2. Downgrade to version 1.0.7 (change composer.json: "box/spout": "1.0.7". I changed the way files are read on Windows, it may have broken the reader in some configurations.

adrilo avatar May 13 '15 16:05 adrilo

Tried both, still failed ...

DVendy avatar May 22 '15 08:05 DVendy

i have the same problem also tried the things adrilo sugested

area722 avatar May 22 '15 11:05 area722

found this issue.. i was trying to read a .xls and this library only works with .xlsx

area722 avatar May 22 '15 12:05 area722

@area722 Spout only works with XLSX files, sorry. @DVendy, can you please share some code? If both solutions did not work, I'm not sure why it failed...

adrilo avatar May 22 '15 18:05 adrilo

public function import_spout(){     
    $reader = ReaderFactory::create(Type::XLSX);
    $reader->open("data.xlsx");

    while ($reader->hasNextSheet()) {
        $reader->nextSheet();

        while ($reader->hasNextRow()) {
            $row = $reader->nextRow();
            var_dump($row);
        }
    }

    $reader->close();
}

Just like in documentation. Oh yes and I used it in Laravel framework. Is there any extra configuration for laravel?

DVendy avatar May 25 '15 03:05 DVendy

The writer working flawlessly btw., :3

DVendy avatar May 25 '15 05:05 DVendy

Just to be sure, when you downgraded Spout to 1.0.7, did you run composer update to update the source files? Given the file path you mentioned, it seems like you are using Windows. And I made a change for Windows in the 1.0.8 version so it's really likely to be the cause of your problem.

If you've already done that, can you tell me which version of PHP you're using and if you are using WAMP/XAMPP. Also, if the file does not contain any sensitive data, would you mind sending it to me at adrien [at] box.com? It will help for debugging!

I'm not familiar with Laravel, but there should not be any additional configuration (and the writer works)

adrilo avatar May 26 '15 18:05 adrilo