Is there a way to convert .xml file to .xls using php code?
views:
125answers:
2
+2
A:
Dunno about converting XML to XSL, but in the book PHP Hacks there is a hack for generating excel spreadsheets most of which is available on Google Books, in its chapter on XML no less!
So that would be a good place to start looking if nobody's got the answer here.
LeguRi
2010-04-01 19:11:55
+3
A:
1) Read in the XML file using [simplexml_load_file()][1]
2) Loop through each XML element representing one line item in the XLS file
3) Use [fputcsv()][2] to create a comma separated file with the data from step 2
4) Save the file with a .csv extension and it will open in excel.
If you want to create an Excel spreadsheet I think you need to work with COM objects. Not my forté so I can't help you with that.
John Conde
2010-04-01 20:10:25