tags:

views:

333

answers:

4

I'm looking to allow users to upload an Excel or CSV file to MySQL for a contact management system. Need to be able to allow users to map their columns so that they are imported into the correct column in the table.

Anyone know of a good site or tutorial on this?

A: 

I don't know of anything that you can pull off the shelf and use, but you should be able to whip something up pretty quickly.

Basically, get the uploaded file, grab the first line (use fgetcsv()). Then dynamically build a little form that displays the data from each column, associated with a dropdown to select the destination field.

timdev
+1  A: 

Check out "insert from infile". I haven't done anything dynamic like this, but I use it all the time for statically formatted reports.

You can read the first line of the report to map the columns.

This might help read an XLS: http://www.phpclasses.org/package/1919-PHP-Stream-wrapper-to-read-and-write-MS-Excel-files.html

therealsix
A: 

Hi,

if the user should map the value you can use dbTube.org It is easy to create your own mapping.

greetings

FreeGroup
A: 

worth a look: dbtube

Timo Hellhagen