We help IT Professionals succeed at work.

XLS to MySQL by selecting Columns

netrinogr asked
Last Modified: 2013-12-13
Hi experts. I have an XLS file (Excel) which has 90 columns. I want to import into a MySQL database the columns 0,1,2,30,65,68,90. How can I do that?
Watch Question

As long as there are no comma characters in your data, save the excel spreadsheet as a CSV (Comma Delimited) file.  This is a text version of your excel spreadsheet.

Then you can use PHP code to read the csv file one line at a time, splitting the line on the comma character, and reading only the columns you want, then writing these columns into your MySQL database.

However, although the code is simple, it's still a couple of hours work, so I recommend you use an excellent free tool at http://www.phpcsvimporter.co.uk/.  This is a simple PHP script that you just configure to connect to your database, and away you go.

If this doesn't work for you, post back and I'll write some example code for you, or look at alternative solutions.
Top Expert 2004
Unlock this solution and get a sample of our free trial.
(No credit card required)
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.