Reading and writing to excel is often a requirement or business need. There are basically 2 ways where you can do that, use an existing library or build your own solution.
Now, before you start, keep in mind that there are 2 kinds of excel file format:
A binary file format where you will need special parsers to read and it’s hard to create one
Open XML format. It’s basically a container. Try renaming any office 2007 or office 2010 documents with extension ending with x (docx, ppsx, xlsx) to a zip file and open it. You’ll find a bunch of text and xml files.
If you want to build your own solution reading and writing a xlsx file, you can refer to this IBM article: Read and write Excel data with PHP
Or else you can rely on 2 open source libraries which will help you save lots of time in both PHP and .NET while working with excel files without having to reinvent the wheel again.
PHPExcel provides a set of classes for the PHP programming language, which allow you to write to and read from different file formats, like Excel 2007, PDF, HTML, … This project is built around Microsoft’s OpenXML standard and PHP.
Excel Data Reader (.NET)
Excel Data Reade Lightweight and fast library written in C# for reading Microsoft Excel files (’97-2007).
– Windows with .Net Framework 2
– Windows Mobile with Compact Framework
– Linux, OS X, BSD with Mono 2+