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?
Excel 2007 files (
.XLSXfiles) 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.