06-08-2005, 12:48 PM
I have some data in Excel File. Like in first cell, "name is stored", in second cell "Father name is stored", in third cell "age is stored".
I want to read this data through php code, and want to store, "Name", "Fathername" and "Age in different variables".
Kindly tell me that how can write this code.
Waiting for a reply soon.
06-08-2005, 12:53 PM
I don't know if there's an equivalent for .xls files but I usually save the excel file as a .csv file then use PHP's fgetcsv() (http://uk.php.net/fgetcsv) function to gather the data.
06-08-2005, 04:38 PM
Currently, I'm working with wordML, though quite different than excels xml output, it does have its similarities. I've tried quite a few different methods, and currently have settled with using a DOM (http://ca3.php.net/manual/en/ref.dom.php) to do my purposes. Now, the DOM is very complex if your new to php or oop in any way whatsoever, so there is also a nice addition to php5 (sorry, no version 4.x) called simpleXML (http://ca3.php.net/manual/en/ref.simplexml.php), which is well... simple. Doesn't have all of the aspects of the straight dom, but is importable/exportable to it which does help. Now, I've chosen to use the dom for my uses because I'm under the understanding that its usable with version 4.3+, though haven't tested it (please, someone tell me if I'm wrong here, don't want to do what I'm doing to find out it won't work on my host :P).
The bigger problem with microsofts excel is understanding what the elements are named for. Some are straight forward, some are not. Take something like: w:jc for instance. Yeah, that represents your texts horizontal alignment, pretty stupid name eh?
Unfortunatly, I do not have any excel documents saved on my system as xml, and currently I'm at a 98 system so I cannot create one. If you want, I can take a look see at one tomorrow to give you an idea of what elements are for what.
Sorry, accidently posted earlier when I wanted to open a new page :P