how can we import data from excel to database
Moderator: General Moderators
how can we import data from excel to database
i need a example code where we can store teh data from excel sheet onto database
-
thinsoldier
- Forum Contributor
- Posts: 367
- Joined: Fri Jul 20, 2007 11:29 am
- Contact:
if it's just raw data and nothing else, no formatting, not graphs, not macro stuff
then just save it as a csv (comma separated value).
read the .csv with file() or file_get_contents()
http://php.net/file
file will turn the csv into an array
once you have array of data it's easy to loop through and put it all in a query.
then just save it as a csv (comma separated value).
read the .csv with file() or file_get_contents()
http://php.net/file
file will turn the csv into an array
Code: Select all
// example:
// sun, moon, stars
// earth, fire, wind
// becomes
array
[0] array
[0] sun
[1] moon
[2] stars
[1] array
[0] earth
[1] fire
[2] wind