Page 1 of 1

Excel to Mysql conversion through PHP

Posted: Mon Aug 18, 2008 9:58 am
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

Re: Excel to Mysql conversion through PHP

Posted: Mon Aug 18, 2008 12:14 pm
by ghurtado
phpmash wrote: Please provide the code for it .
You are hilarious.

Re: Excel to Mysql conversion through PHP

Posted: Mon Aug 18, 2008 12:18 pm
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
}