how to import a file to mysql

nerv82

Registered
I have a file in excel and i need to import that to my data base how can do this?
thanks
nerv82
 
Hmm, incidentally, the Google ads in this page as I'm viewing it are SQL4X Manager J and SQLGrinder for Mac OS X... I wonder if either of these would work?

When I select Save As... in Excel's File menu, I have a number of options to choose from to format the data. I'm not sure what any of them mean, but you should see if your MySQL editor can import any of those, or if you can find a tool that would convert those to MySQL. Perhaps DIF (data interchange format)?

I did a little searching, and I found this tutorial for transferring from FileMaker Pro to MySQL. One of the steps includes exporting it as comma-delimited text, which Excel can do, so you may be able to adapt this tutorial to suit your needs.
 
nerv82

did you solve your problem? I have trouble getting past the first row of my .txt files. Problem is what to put in the "line terminated by **" modifier to the "load data" command.

Macs use different end of line characters. Anyone know how to display them in mySQL?
 
I solved my problem. All previous attempts had given me either only the first row or a corrupted table that lost the first pipe character of the table after the first row.

The problem seems to be in the way text edit and word and excel create text files, but I don't know. Anyway, this is how I did it.

I put \n in the last cell of each row, then saved the excel file as text. I opened the resultant file in word and then copied it into pico and saved it from there.

Using - load data infile "path to file" into table mytable; - gave me the result I needed.

My excel file was 250 rows. I don't know if pico has a size limit.
 
in future, just export as CSV, and tell MySQL to use the \r character as the end of line identifier. No need for word or pico.
 
Back
Top