Skip to content

XMLReader::open(): Unable to open source data #56

@Kryptonit3-zz

Description

@Kryptonit3-zz

I have a really large XLSX file (150,000 rows, 16 columns). I receive this file from the company I work for and have no control over its format or features.

Before it gives me the XMLReader::open() error, it gives me No loader for type error. I fix this by manually specifying the type as a second parameter like this: $workbook = SpreadsheetParser::open($request->file('spreadsheet'), 'xlsx');

When I attempt to open it I get this error XMLReader::open(): Unable to open source data. I did some searching and saw this was an issue a while back on issue 22 ( #22 ).

I have tried adding libxml_disable_entity_loader(false) before SpreadsheetParser::open() and it still fails.

libxml Version => 2.9.4

What is weird is, that if I open this xlsx file in excel, and then save, and then reattempt the newly saved file it works. Like it somehow fixes an imperfection or something.

I have attached the file in its original format. It errors out. Try opening and saving and then reprocessing and it should work. No idea why. Would like to figure out a way to bypass this added step so I can just process it all in one go from PHP.

Original

SOR_Contractor_Equipment_UXID_Report.xlsx.zip

After I open it with Excel, and go to File->Save-> (rewrites I am assuming).

Resaved_SOR_Contractor_Equipment_UXID_Report.xlsx.zip

P.S. This library is for some reason 4 times faster than box/spout. I originally started with them but it was taking almost 80-90 seconds to parse this file while this library parses it in about 15-20 seconds. On another note, their library can open the file without me having to resave it. I think they use a different opening method though, you use XMLReader::open and I think they use ZipArchive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions