Convert .xls file to xml using php

I need to implement a functionality where a user can upload an Excel file, that is, .xls file and i need to write a function that will read that file and then save the values in a table, compare them to values in another table and then print some kind of billing quotation. From what I have read, it seems that the best way to do that is to first convert that file to an xml file and then write a function to parse that xml file. I want to know, is it possible to write a function in php that will convert an xls file to xml. Assuming that the users will save and upload the file as xls.

Thanks.

Answers


i often let admin users upload a csv file they exported from an xcel file, its much simpler to parse through using http://php.net/manual/en/function.fgetcsv.php


A quick Google search for "PHP excel parser" turns up PHP Excel Reader, for an open source library to use for reading data from .xls files. There may be others that suit your needs.


I have been successfully using the 'ABC Excel Parser Pro' from Zakkis.

This allows converting from a XLS file directly into a MySQL table.

A few notes on limitations:

  • column count must match exactly to database columns
  • Excel 2007 format (xlsx) are not supported

Need Your Help

How do I perform a simple string mapping as part of a t-sql select?

sql sql-server sql-server-2008 tsql

In T-SQL, I can do arithmetic as part of a select. For example, suppose I have a table Math with a column named Decimal. I can do the following query.

Where date difference between now and max date value is greater than X

sql postgresql date max datediff

I want to return a result set (from postgres database) containing clients whose last payment date was more than X number of days ago.