views:

23

answers:

1

Hi,

I am trying to read excel 2007 file through php. I found one such example on PHP COM manual but it only works on windows system since COM objects require MS Excel to be installed. Since I have Linux machine that code doesn't work for me.

Does anybody know the workaround for this?

Due to some restrictions, I don't want to use any outside libraries (PHP-ExcelReader, PHPExcel, etc.) to do the same.

Thanks,

A: 

I don't know why you're so unwilling to use libraries that have been specially written to do exactly what you're requesting, but there are still a couple of options open to you.

Excel2007 files are simply a zipped series of XML files, so it is perfectly possible to parse them with SimpleXML or XMLReader, and the format is fully documented on the MS website (don't have the link to hand at the moment, unfortunately), so you can always "roll your own". It's likely to take a while (I've been working on PHPExcel now for over 3 years and it still doesn't support all features of the Excel 2007 format), but look at the PHPExcel Excel2007 Reader for some idea on how to do so, even if you're unwilling to use the library.

Alternatively, Open Office Calc supports COM and COM can be mimicked on other OS's (XPCOM, CORBA); or you could probably fake it using WINE.

Mark Baker
Thanks Mark, I will try to see if I can do it using parsing the XML otherwise as you and halfdan say I will have to go for external libraries.
Anant