Forum Moderators: open
So I have an excel file with a bunch of columns that match my mysql database and I want to import them in a speedy and easy manner. I've been doing it by saving the excel as a csv file and then specifying in phpmyadmin when doing the import that fields are separated by a comma, but now I have more fields where there are usually commas in the middle of the field and that screws everything up. It doesn't have an option in phpmyadmin to import straight from xls, so I don't know what to do now. The only other option other that CSV and CSV USING LOAD DATA is SQL, which I don't think would work very well unless I could write an entire parsing script from the excel file.
Any suggestions would be appreciated. Thanks.
Fields terminated by: ;
Fields enclosed by: "
Fields escaped by: \
Lines terminated by: auto
Column Names:
I change fields to be terminated and enclosed by commas, and make lines terminated by "+". (I make the last column in my excel file a column of +'s so that when it does mess up it doesn't follow to the next row.) This works for everything except fields with commas, which makes sense. If I leave it as default it doesn't do anything, and I can tell by opening the csv file in wordpad, and it's really just the fields separated by commas.
cell 1: apples
cell 2: bananas, oranges, pears
cell 3: grapefruit
when i save it as a comma delimited .csv file, it comes out as this:
apples,"bananas, oranges, pears",grapefruit
and i can import that to the table as it is.
maybe it is something to do with what the cell contains. mine are all text fields. are yours numbers or something like that?