how can i read excel sheet to our database
Moderator: General Moderators
-
B.Murali Krishna
- Forum Commoner
- Posts: 28
- Joined: Fri May 12, 2006 2:05 am
- Location: Hyderabad,India
- Contact:
how can i read excel sheet to our database
how, can i read the data in excel sheet to database,
I remember finding an XLS file parser at one point (search google), but as I remember it was a beta, and still buggy. You would be better off saving the file as a CSV. Then it's just plain text, and easy to parse.
This script will load a csv file into a 2-dimensional array called csv_data:
This script will load a csv file into a 2-dimensional array called csv_data:
Code: Select all
$csv_file = "my_csv_file.csv";
$csv_data = array();
$f = fopen($csv_file,"r");
while ($line = fgetcsv($f,1024,",","\""))
{
array_push($csv_data,$line);
}
fclose($f);