0

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?

1
  • Are you storing data into a single table (1:1) or into more than one relational table (1:M)? A 1:M relationship will vastly complicate the solution, but is not impossible. Commented Apr 15, 2010 at 3:28

2 Answers 2

2

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

Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.