Topics:
DVR
nvrec
Mplayer
Links
Misc
Commands
Humor
New user
uploaded files
|
(links)-> (Parent)->Import spreadsheet (csv) data into mysql database |
submited by Russell Sun 09 Sep 07 |
After way too much searching I found :
mysqlimport
This will import data from a spreadsheet (saved as a csv , comma separated values, also works for tab seperated) into a mysql database. It's really quite powerful, but it does have a few shortcomings that are not difficult to work around.
What I like about it is that it will read the header row of the file and use that to create the column (field ) names. (several other things I found in searching lacked this option and would need me to manually specify each column name)
The problems I Had were with column names that were not acceptable names. mysql_import will tell you if you have spaces in the names, but it doesn't fix it. Once I changed the column names to remove the spaces I still had problems but I was getting cryptic mysql error mesages and it took some debugging to figure it out. The file I was sent contained parenthesis () a decimal (.) and a duplicate in the column header names.
Once I figured out the problems, I was able to fix my column headers (again) and, quickly import the data.
Other Potential Problems:
Because it runs on a websever you may run into limitations of filesize and execution time limits (set by Apache). Since this program actually calls the command line tool ( instead of using the perl mysql access tools), I have to wounder why this program isn't just written as a command line tool. Then you would avoid the Apache limits. But then again, you would lose the simple web-based form to input your settings.
|
Add comment or question...:
|