Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Insert Data from Excel Sheet to MySQL Database using PHP

Hello All,

I'm trying to build a web application which will require me to upload large amounts of data from excel spreadsheets on a repeated basis. I am making my application using PHP and MySQL.

I was wondering if anyone could point me to a tutorial/provide some hints regarding how I will be able to insert spreadsheet data into the MySQL Database using PHP.

Thanks in advance!

2 Answers

Ricky Catron
Ricky Catron
13,023 Points

You could save the exel data as a CSV file thencheck out http://www.homeandlearn.co.uk/php/php10p6.html or google "read CSV file with php" for other solutions.

Thanks for your input!

Ricky Catron
Ricky Catron
13,023 Points

Happy to help! I tried to find out how to do it in python for weeks before i found CSV format!

Robert Komaromi
Robert Komaromi
11,927 Points

This post is a bit old, but since I came here from a Google search I thought I would add an answer. If you need to work with Excel using PHP, you can check out PHPOffice's PHPExcel.

If you are using Laravel, take a look at this Laravel-Excel package - I have used it successfully in a web app I am developing.