Forum Moderators: coopster

Message Too Old, No Replies

MyphpAdmin to import excel data into MySql

extraneous character getting imported with excel text fields

         

marisha

7:49 pm on Sep 27, 2010 (gmt 0)

10+ Year Member



I am trying to import an excel sheet data into MySql DB using MyPhpAdmin.

Following are the data types in my excel sheet
1) number
2) text fields e.g
  2.1) Class E, Business Units
2.2) University Hall
2.3) East Campus

3) I am converting excel sheet into a tab delimited file

4) I am importing into MyPhpAdmin with the follwing settings
4.1) fields terminated by - \t
4.2) fields enclosed by - (optional)
4.3) fields escaped by - \
4.4)lines terminated by - \n
4.5) Columns - here I am mentioning the order or columns in excel sparating them with ,
e.g campus_location,building_name,


5) After importing the strings mentioned under point 2 appear like this
2.1)?Class E, Business Units
2.2) ?University Hall
2.3) East Campus


As you can see the third string is not having a "?". I have no idea why this is happening.Any help is welcoming


Thanks,
Marisha

Anyango

11:19 am on Sep 28, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello Marisha

Welcome to WebmasterWorld. It seems like a file encoding issue. Have you verified that your excel file was saved with proper encoding and your database too? is this transfer from Windows to Linux ? It doesnt matter all the time but sometimes if file transfer is not with proper encoding that does happen

marisha

2:44 pm on Sep 28, 2010 (gmt 0)

10+ Year Member



Dear Anyango

Thank you for replying. I was able to solve the problem yesterday.
I rechecked the excel fields to see why some strings were appended with "?" and some were not. I found that some excel fields were having space before the String that was getting converted into "?" character.

I used the TRIM function on those fields to take out the space character and then I did not get this problem.

this is a lesson learnt.. :)... check for things that are not visible as well

Marisha

[edited by: marisha at 2:54 pm (utc) on Sep 28, 2010]

Anyango

2:54 pm on Sep 28, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Glad its sorted ;) Thats a nice start after joining the forum, you immediately posted a solution of a problem. Must be appreciated :)