You are viewing yincrash

A Day in the Life of the Diary of YinCrash - How to export your T-Mobile Contacts to Google Contacts
yincrash
yincrash
Share
How to export your T-Mobile Contacts to Google Contacts
UPDATE (8/1/2009) : It appears that T-Mobile released a contacts sync app! http://apps.t-mobile.com/ I haven't tried it, but it probably nicely solves the problem that this post solved a year ago.

UPDATE (6/25/2009) : Changed instructions and code to a bookmarklet! Much easier and doesn't require firefox! keywords: T-Mobile, google, mytouch 3g, g1, android, contacts, export, import, phone, address book

UPDATE (3/30/2009) : T-Mobile has made a couple of changes which caused this script to break. As of today, I updated the script on this page to work properly. Please let me know if it breaks again. I don't think they are purposely breaking, they just implement new things in the javascript w/o telling me.


So, last week, I received my new T-Mobile G1 (previously known as the HTC Dream) which runs on the new fangled Google Android mobile platform. FANCY.

I'm really enjoying playing with it. I'm currently working on making stuff for it.

However, there is one thing I needed sooner rather than later. All my contacts from my old phone.
T-Mobile has a fancy service that syncs all your phone contacts to a T-Mobile server. It lets you manage your contacts on their website, and I imagine one of the original intentions as well was to make switching to a new phone easier. However, the T-Mobile G1 currently has no such feature to sync with your T-Mobile address book. I imagine this is mainly because it syncs with your Google Contacts (yeah, that you use in your gmail and maybe gtalk, but very few other places). This is fine and nice and dandy except I still want all my old phone numbers.

I'm hoping that eventually T-Mobile will release an App that can do the syncing in a clean and proper faction, but until then, I found a javascript hack that someone put together to export the address book from the T-Mobile website address book page. He created it to help a friend who bought an iPhone bring her old address book to her new friend. However, while what he did fairly clear to a web developer, it's not easy to implement for everyone.

So, I tried to make a webpage to do the work for you. Basically, I wanted to rip the data out of the webpage from another webpage. This used to be possible. However, now it isn't. Browsers have implemented permissions to prevent this sort of thing when the pages are from two different domains because it can be used to steal passwords or other sensitive data. Maybe it's still possible to create a web based tool by making the tool's server as a proxy or something, but that means placing a lot more trust in the web tool to not record or divulge your password and such. Also, it would require more work. I got what I needed to get.

At the very least, I changed his code to export to Google's CSV contact format. Just using what his code created did not play that well with Google Contacts. It jammed almost everything into the "Notes" section. I also wrapped the output in a <textarea> tag to make it much easier to copy and paste.

How to export your T-Mobile Contacts to Google Contacts
What You Need: 
  • A webbrowser (this method was tested with firefox and google chrome, but it should work with all major browsers)
  • T-Mobile Contacts
Caveats:
This only exports the following fields,
  • Name
  • Home Mobile Phone
  • Home Phone 
  • Home Email
  • Work Mobile Phone
  • Work Phone
If you need more than these fields, you need to edit the code. You can try asking me for more fields mappings.
What to Do:
  1. Browse http://my.t-mobile.com/ to get to the Contacts page. As of this writing, the page title says T-Mobile MobileLife(SM). You should be able to see all your contacts and do stuff to them.
  2. Add a bookmark to your browser, the name/title can be anything, like "Export Contacts from T-mobile". Copy the following code and paste it in to the URL field
  3. Save the bookmark.
  4. While viewing the T-Mobile Contacts page, click on the bookmark.
  5. A text box should appear. Some browsers say the page is still loading, but really it is not. The text box contains all of the exported data. Select All of this text (Control+A) then copy it to a text file and name it "contacts.csv" or something like that. 
  6. Go to GMail.
  7. Go to Contacts
  8. Select All your contacts and export them. You want to back up your contacts, so you have a clean copy. Importing contacts in Google can result in duplicates. It does have some duplicate checking, but I'm not sure how good it is.
  9. Import your "contacts.csv" file that you created.
  10. Make crazy phone calls from your new phone.

Comments
Page 1 of 2
[1] [2]
From: (Anonymous) Date: December 27th, 2008 09:03 pm (UTC) (Link)

Not working?

Hey there . . . thanks for this. I'm THIS close, but alas, it's not working. I get "ReferenceError: TMO is not defined" when I try to run the script. Perhaps something has changed . . . ?
yincrash From: yincrash Date: January 5th, 2009 12:49 pm (UTC) (Link)

Re: Not working?

the TMO object is still there for me. can you tell me how you got to the contact page to make sure it's the same page I'm looking at?
Re: Not working? - (Anonymous) - Expand
Re: Not working? - (Anonymous) - Expand
From: (Anonymous) Date: March 30th, 2009 07:19 pm (UTC) (Link)
mine isn't putting the numbers in the list. there is a problem with L_footer_pane
yincrash From: yincrash Date: March 30th, 2009 07:36 pm (UTC) (Link)
yeah. i forgot to update the code when i got home that day. i will do it tonight!
(Deleted comment)
From: (Anonymous) Date: May 11th, 2009 10:19 pm (UTC) (Link)
worked perfect. Thanks so much!
From: (Anonymous) Date: May 30th, 2009 05:37 pm (UTC) (Link)
getting TMO not defined even with the updated code. Any suggestions?
From: (Anonymous) Date: June 16th, 2009 06:26 pm (UTC) (Link)

Mike4King

worked awesome for me. thank you so much!!!
From: (Anonymous) Date: June 18th, 2009 09:17 am (UTC) (Link)

help :/

I'm getting

>>> var data = ["Name,Section 1 - Description,Section ...r\n') + ''; $('L_footer_pane').update(dataHolder);


help?
From: (Anonymous) Date: June 18th, 2009 09:19 am (UTC) (Link)

Re: help :/

oh oops. Closed out the console and whaddya know. My contacts!
thx :)

eBay buyers: You can get a rebate on your eBay purchases at http://PaymentKey.com.
eBay Sellers: You can make money on your listings...whether or not your item sells. Join http://PaymentKey.com and read the Writearn instructions today.
From: (Anonymous) Date: June 23rd, 2009 02:59 pm (UTC) (Link)

Thanks

Without this I'd return the phone. TMo should buy this from you!
From: (Anonymous) Date: July 4th, 2009 10:12 am (UTC) (Link)

extended version

Mike - Thank you so much for this!

I have edited/personalized to include all fields on the T-Mobile contact details page (as of July 4, 2009, USA T-Mobile), with the exception of person title ('civility') and notes ('comment'). I left off title because it is a dropdown and I could only get it to include the item number on the list (e.g., "4" for "Dr") instead of the value itself (e.g., "Dr"). I left the state field dropdown ('persoCounty' and 'proCounty') and country field dropdowns (persoCountry and proCountry) but assume these will have the same issue if a contact has a values there (none of mine do).

Hope this helps someone out....

javascript:var data = ["First Name,Last Name,Section 1 - Description,Mobile Phone,Home Phone,Home Phone 2,Pager,Home Fax,E-mail Address,Personal Web Page,Home Street,Home Street 2,Home Country,Home City,Home State,Home Postal Code,Section 2 - Description,Business Phone 2,Business Phone,E-mail 2 Address,Business Fax,Web Page,Company,Job Title,Business Street,Business Street 2,Business Country,Business City,Business State,Business Postal Code,"];TMO.ABPORTAL.LIBAB.contactManager._datas.each(function(person) {var a = [];a.push(person.firstname);a.push(person.lastname);a.push("Personal");if(person.homeMobile != null) {a.push(person.homeMobile.value); } else { a.push("") }if(person.homePhone1 != null) {a.push(person.homePhone1.value); } else { a.push("") }if(person.homePhone2 != null) {a.push(person.homePhone2.value); } else { a.push("") }if(person.homePager != null) {a.push(person.homePager.value); } else { a.push("") }if(person.homeFax != null) {a.push(person.homeFax.value); } else { a.push("") }if(person.homeEmail != null) {a.push(person.homeEmail.value); } else { a.push("") }if(person.homeWebSite != null) {a.push(person.homeWebSite.value); } else { a.push("") }if(person.persoStreet1 != null) {a.push(person.persoStreet1.value); } else { a.push("") }if(person.persoStreet2 != null) {a.push(person.persoStreet2.value); } else { a.push("") }if(person.persoCountry != null) {a.push(person.persoCountry.value); } else { a.push("") }if(person.persoCity != null) {a.push(person.persoCity.value); } else { a.push("") }if(person.persoCounty != null) {a.push(person.persoCounty.value); } else { a.push("") }if(person.persoZipCode != null) {a.push(person.persoZipCode.value); } else { a.push("") }a.push("Work");if(person.workMobile != null) {a.push(person.workMobile.value); } else { a.push("") }if(person.workPhone1 != null) {a.push(person.workPhone1.value); } else { a.push("") }if(person.workEmail != null) {a.push(person.workEmail.value); } else { a.push("") }if(person.workFax != null) {a.push(person.workFax.value); } else { a.push("") }if(person.webSite != null) {a.push(person.webSite.value); } else { a.push("") }if(person.company != null) {a.push(person.company.value); } else { a.push("") }if(person.jobtitle != null) {a.push(person.jobtitle.value); } else { a.push("") }if(person.proStreet1 != null) {a.push(person.proStreet1.value); } else { a.push("") }if(person.proStreet2 != null) {a.push(person.proStreet2.value); } else { a.push("") }if(person.proCountry != null) {a.push(person.proCountry.value); } else { a.push("") }if(person.proCity != null) {a.push(person.proCity.value); } else { a.push("") }if(person.proCounty != null) {a.push(person.proCounty.value); } else { a.push("") }if(person.proZipCode != null) {a.push(person.proZipCode.value); } else { a.push("") }data.push(a.join(","));});var dataHolder = '';document.write(dataHolder);

From: (Anonymous) Date: July 4th, 2009 10:14 am (UTC) (Link)

Re: extended version

PS - Forgot to mention: the headers (field names for CSV) are all based on standard Outlook headers. The idea was to improve automatic mapping to fields when importing to Gmail contacts (which seems to do well with these Outlook standards).....
From: (Anonymous) Date: July 9th, 2009 11:51 pm (UTC) (Link)

Easy

Excellent work. Couldn't have asked for more.
From: (Anonymous) Date: July 16th, 2009 01:52 am (UTC) (Link)
brilliant, man. Worked like a charm. Thanks!
From: (Anonymous) Date: July 18th, 2009 08:59 pm (UTC) (Link)

Thank You

Worked like a charm.
Thank you sir.
and...
fuck t-mobile for not having an export option.
From: (Anonymous) Date: August 8th, 2009 06:04 pm (UTC) (Link)

Thank you!

your script saved me a lot of typing.
Thank you!
From: (Anonymous) Date: October 18th, 2009 07:07 pm (UTC) (Link)

saweet

sweet awsome man thanks a ton saved me hours of my life
From: (Anonymous) Date: November 7th, 2009 05:14 pm (UTC) (Link)

thanks

exactly what i needed, and i didn't have to code anything myself. woohoo
From: (Anonymous) Date: November 13th, 2009 04:26 am (UTC) (Link)

worked beautifully for me

Just ran this in firefox on my mac, worked beautifully, hats off to you
From: (Anonymous) Date: January 11th, 2010 10:42 pm (UTC) (Link)
great script. the tmobile sync app fails for me, but this is brilliant! thanks!
From: (Anonymous) Date: March 15th, 2010 08:20 am (UTC) (Link)
thank you for the guide and script :)
From: (Anonymous) Date: March 22nd, 2010 02:22 am (UTC) (Link)

Thanks!

You're awesome, thanks a lot!
From: (Anonymous) Date: April 10th, 2010 05:14 pm (UTC) (Link)

please help?

This isn't working for me at all. Is it because I have a sidekick and use the desktop interface address book instead of a contacts page? I've tried in both IE and Firefox. I don't understand what "clicking on the bookmark" means - neither browser lets me do that. I'd love to get my contacts exported. Please help!!
yincrash From: yincrash Date: April 10th, 2010 05:42 pm (UTC) (Link)

Re: please help?

clicking the bookmark just means opening the bookmark. there is no contacts page for you in my.tmobile.com?
From: (Anonymous) Date: August 16th, 2010 01:49 pm (UTC) (Link)

Thank You!!!

This script is awesome!!! Just saved me hours of work to import my contacts to a jail broken iPhone!!
From: (Anonymous) Date: August 28th, 2010 09:01 pm (UTC) (Link)

fantastic

Thank you for posting this!! I just got the mytouch slide (talk about a pedophelic name for a phone) and cannot get contact sync to work with tmob. WTF why would you release a phone that won't even work with your internal contacts system? Isn't that the point of mobile backup - so you can bring your contacts to a new phone?? Then not give any option for export?

It's sheer lunacy. But luckily you came to the rescue. Thanks!
From: (Anonymous) Date: September 22nd, 2010 10:44 pm (UTC) (Link)

thank you

this worked great!!!...thanks!!!!...been trying to recover contacts for days
From: (Anonymous) Date: September 27th, 2010 02:51 pm (UTC) (Link)

Thanks a lot

Thank You so much, this helped me to copy all my contacts without have to manually enter into the details into my new iphone-4.
From: (Anonymous) Date: November 18th, 2010 10:52 pm (UTC) (Link)

Groups?

Is there any way to export them with the groups that they are assigned to? The more detailed code available here seems to push "Work" onto all of the contacts. Thanks in advance! :)
From: (Anonymous) Date: January 18th, 2011 02:57 am (UTC) (Link)

Amazing

Thank you Yincrash.

Being on my final days with T-Mo, I needed to sync all of my contacts with my Google account. This wasn't possible until I found this website. You. Are. Awesome.
From: (Anonymous) Date: February 23rd, 2011 03:07 pm (UTC) (Link)

Thanks a bunch.

I've been meaning to organize my contacts for a while now. This made life soo much easier. Thank you soo much.
52 hungry kids or Are you hungry?
Page 1 of 2
[1] [2]
profile
Mike
User: yincrash
Name: Mike
Website: My Website
calendar
Back October 2008
1234
567891011
12131415161718
19202122232425
262728293031
cow says what?
moo.
non-LJ journals
counter
you are number
wow.
send me a message
Send me a text message to my phone!
page summary
Anonymous Not working? [+3]
Anonymous (no subject) [+3]
Anonymous (no subject) [+1]
Anonymous Mike4King
Anonymous help :/ [+1]
Anonymous Thanks
Anonymous extended version [+1]
Anonymous Easy
Anonymous (no subject)
Anonymous Thank You
Anonymous Thank you!
Anonymous saweet
Anonymous thanks
Anonymous (no subject)
Anonymous (no subject)
Anonymous Thanks!
Anonymous please help? [+2]
Anonymous Thank You!!!
Anonymous fantastic
Anonymous thank you
Anonymous Thanks a lot
Anonymous Groups?
Anonymous Amazing
tags