I have an excel spreadsheet with about 500 rows that i want to insert into a MySQL table. Is there a quick and easy way to do it?
Cheers
There are definately programs that do it, like navicat, can also be done by php.
Never done it myself but just look around on google and you will find a method
You could just write a small bit of code in excel
Function insert_to_MySQL()
Dim oApp as MySQL.Application
Dim oTab as oApp.Table
Dim iTemp as Integer
set oApp = New MySQL.Application
set oTab = oApp.Tables.Add("NewTableName")
iTemp = 1
Do While Not Range("a" & iTemp) = ""
DoCmd.RunSQL("SELECT INTO " & oTab & " VALUES(" & Range("A" & iTemp & ")" & " & Range("B" & iTemp & ")" & " & Range("C" & iTemp & ")" & " & Range("D" & iTemp & ");")
iTemp = iTemp + 1
Loop
End Function
The syntax for MySQL may be wrong in that.... ive not got it installed so couldnt reference it!
cheers for that, Ive managed to do it now :)
Or... you could just export to CSV, and import using phpMyAdmin (pretty sure it can do that)
How did you do it?
i only needed one column of data to go into a table so i just transposed the column into a row in excel and exported it to CSV and then just pasted it into a form i wrote that exploded the huge long string into an array and added everything from there.
not pretty but it was quick and since I only needed to do it once I decided I couldnt be bothered with a prettier way :p
thanks for your help though - might play with that sometime and see if I can make it work :)