user1577291
user1577291

Reputation: 365

Invalid file format when attempting to read Excel 2007 files in PHP

I am trying to read data from Excel 2003 but I want the system also to load Excel 2007 files. However Excel 2007 file is triggering the file format exception. The code that checks the format is here

if ($this->header ['ident'] != "\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1")
        throw new compoundDocumentException ('Invalid file format');

In this line I would like to add the header indent for Excel 2007 which I didn't find wherever I tried.

How do I achieve this please?

Upvotes: 0

Views: 291

Answers (1)

user149341
user149341

Reputation:

Excel 2007 files (.XLSX files) use a completely different XML-based format from previous versions of Excel. Simply checking for a new header will not help you at all here -- you will need an entirely different file reader for these newer files.

Upvotes: 1

Related Questions