How can i read .xls files (Excel) with PHP?

Kristian Rafteseth picture Kristian Rafteseth · Nov 14, 2011 · Viewed 46k times · Source

I need to convert an .xls file to text, i dont need it formatted in any way. The file is filled with productids like PN-5098P, which i will preg_match_all to get.

What is the simplest solution? I tried simply opening the file in a regular texteditor, the ids are not showing, so i guess i need some kind of binary converter?

Answer

Matchu picture Matchu · Nov 14, 2011

XLS is a complex proprietary format, and it might be difficult to work with. If you end up having trouble with libraries like Clint suggested, consider only accepting files in a more simpler format, like CSV, which is super-duper easy to deal with. If that solution is acceptable in this situation, it'll end up making your life much easier.