Excel to Mysql conversion through PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
phpmash
Forum Newbie
Posts: 24
Joined: Mon Oct 31, 2005 6:41 am
Location: Kerala,India
Contact:

Excel to Mysql conversion through PHP

Post by phpmash »

I one of my site, the students mark list is available in Excel file.
The site administrator will upload the Excel file in to Web Server and need to covert the data in to MySQL table through PHP .
Please help me
(php 5.2.6/MySQL4.1.22/Linux)
Thanking You
phpmash
Last edited by phpmash on Tue Aug 19, 2008 8:09 am, edited 1 time in total.
User avatar
ghurtado
Forum Contributor
Posts: 334
Joined: Wed Jul 23, 2008 12:19 pm

Re: Excel to Mysql conversion through PHP

Post by ghurtado »

phpmash wrote: Please provide the code for it .
You are hilarious.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Re: Excel to Mysql conversion through PHP

Post by Luke »

are you serious dude? nobody here is going to do this for you. Here is a shameless plug...

PHP CSV Utils

This library can read excel-formatted csv files, but not .xls files or w/e it is. So you'd have to export it to csv. It'd be something like this:

Code: Select all

$reader = new Csv_Reader('./your-csv-file.csv', new Csv_Dialect_Excel);
foreach ($reader as $row) {
    // insert into database
}
Post Reply