Dear Friends. :)

I am new to this forum and php coding as well.
1. I would like to know
whether we can able to import .xls excel file contents into the mysql
database
table using php.?

Objective:
User has to browse the excel file from their system and import the contents into the mysql server.

Code Requirement:
Can we able to check each row in the user specified excel sheet with the server database table ( to check whether the particular record is already stored in the database) and do some modifications in the user excel sheet and import it into the database finally.?

I googled and found this great supportive forum. :) Can anybody help me? Thanks in advance :)

Yeah! Im also new to programming php.. But I think there's a function that would parse your csv files.. just search on ur php manual... it fgetcsv.. something like that... Had an experience in doing csv parsing during my student training days... after u parsed the csv file just do the insert statement.. much better if u do that in OOP mode.

Thanks!


Dear Friends. :)

I am new to this forum and php coding as well.
1. I would like to know
whether we can able to import .xls excel file contents into the mysql
database
table using php.?

Objective:
User has to browse the excel file from their system and import the contents into the mysql server.

Code Requirement:
Can we able to check each row in the user specified excel sheet with the server database table ( to check whether the particular record is already stored in the database) and do some modifications in the user excel sheet and import it into the database finally.?

I googled and found this great supportive forum. :) Can anybody help me? Thanks in advance :)

Thanks for your post. I have got a very good article that stores csv file contents into the database. But my requirement is not for .csv files. fgetcsv can read csv files. But i want to know which class can read .xls files? !

I see that you were specifically asking about using php; however, if you have access to phpmyadmin, then that is a simple way to get your excel files into mysql.

This old fart is just learning this stuff, but that much I got figured.

Thanks for your post Chris, I have downloaded the php-excel-reader. It is only reading and displaying the .xls file but could you please let me know how to do some modification in the excel file and save it into the database.?

From the documentation, you can access the table contents as follows:
Access by row and column
$data->val($row,$col)
You can also use column names rather than numbers:
$data->val(10,'AZ')
Access data on a different sheet:
$data->val($row,$col,$sheet_index)

I haven't spent much time (yet) exploring the different possibilities but you should be able to:
* loop through the cells, modify the data if necessary and save it to mysql.
* Copy the content to another table; modify the content as necessary in that table; display that table and then call my desktop_write utility to save it.

I haven't done the full end-to-end version of this but it shouldn't be difficult.

This article has been dead for over six months. Start a new discussion instead.