NBU to CSV 2.1 Updated Version.

Posted: November 9, 2011 in Windows Scripts
Tags: , ,

*** Updated Version to resolve names not being exported on some NBU files ***

This is the Updated Version of the Script that removes some extra “;”‘s from the Name. The Heading fields also more closely match the once in Outlook.

Also It now cope with mutiple cell phone numbers. The script only extracts contact, not message or photos etc. Please give it a go and see if it works for you.

To get this to work,

  • Copy the text in the box below, and save the file as Convert.vbs. Thes file should look like this :-
  • Call you nbu file : File.nbu and make sure that both files are in the same directory.
  • Double click on the Convert.vbs file (you may get an error message!)
  • Check for a file call Output.csv (This should contain all your Contact and number).

''*****               Convert NBU file to CSV             ********
''*****                09 October    2012                 ********
''*****              http://MGinternet.co.uk              ********
''*****                                                   ********

Dim Fso, debugmode, ContactName, lineSplit, MobileNo, HomeNo,WorkNo
dim MobileNoX,MobileNoX2, HomeNoX,WorkNoX, org, Title
Set Fso = WScript.CreateObject("Scripting.FileSystemObject")
'Create user
set Userlist = fso.openTextFile("file.nbu",1)
Set Report = fso.OpenTextFile("Output.csv",8,1)
report.writeline("Name,Mobile Phone,Home Phone,Business Phone,Company,Job Title,Car Phone")
    MobileNoX= ""
    WorkNoX= ""
    HomeNoX= ""
    refNoX = ""
    Org = ""
    Title = ""

do while not Userlist.AtEndOfStream

 Details = Userlist.readline
 if debugmode =1 then msgbox(details)

 if left(Details,2) = "N:" or left(Details,2) = "N;" then

   lineSplit = split(Details,":")
    ' if left(Details,2) = "N;" then lineSplit = split(Details,";")
    if ubound(lineSplit) > 0 then 
    contactname = linesplit(ubound(lineSplit))
    contactname = "Unknown"
    end if
    ' clear out extra ; in then name
    contactname = replace(contactname,";"," ")
'    lineSplit = split(contactname,";")
'    contactname = chr(34) & trim(LineSplit(1)) &" "& trim(LineSplit(0)) & chr(34)
    if debugmode = 1 then msgbox(contactname)
end if

    If FindString((details),"CELL") Then
        if MobileNoX = "" then
                MobileNo = split(Details,":")
                MobileNoX = MobileNo(1)
                MobileNo = split(Details,":")
                MobileNoX2 = MobileNo(1)
        end if

        if debugmode =  1 then msgbox(MobileNo(1))

    End If
    If FindString((details),"HOME") Then
        HomeNo = split(Details,":")
        HomeNoX = HomeNo(1)
        if debugmode =  1 then msgbox(HomeNo(1))
    End If
    If FindString((details),"WORK") Then
        WorkNo = split(Details,":")
        WorkNoX = WorkNo(1)
        if debugmode =  1 then msgbox(WorkNo(1))
    End If

    If FindString((details),"PREF") Then
        if  (FindString((details),"HOME")) = False and _
            (FindString((details),"CELL")) = False and _
            (FindString((details),"WORK")) = False Then  
        WorkNo = split(Details,":")
        WorkNoX = WorkNo(1)
        if debugmode =  1 then msgbox(contactname & " on the number " & WorkNo(1))
    End If
    end if

 if left(Details,3) = "ORG" then
     org = Replace(SplitLine(1), ";","")

 end if

  if left(Details,3) = "TIT" then
     Title = Replace(SplitLine(1), ";","")

 end if

 if left(Details,3) = "END" then
 if debugmode =  1 then msgbox("Do End Write")
    report.writeline(contactname & "," & MobileNoX & "," & HomeNoX & "," & WorkNoX &  "," & Org & "," & title & "," & MobileNoX2)
 if debugmode =  2 then msgbox(contactname & "," & MobileNoX & "," & HomeNoX & "," & WorkNoX &  "," & Org & "," & title)
    MobileNoX= ""
        MobileNoX2= ""
    WorkNoX= ""
    HomeNoX= ""
    refNoX = ""
    Org = ""
    Title = ""
End if



Function FindString(strCheck,strFind)

    intPos = 0
    intPos = InStr(strCheck, strFind)
    FindString = intPos > 0

End Function

Output should be something like this :-

As long at the data is in the correct place on your phone, it should appear on the CSV output file (if you open the file in Excel the number may look a bit funny as excel trys to format them). Open it in notepad to confirm the number are correct.

  1. Mahesh says:

    This is ultimate! But how can we extract name?

  2. mginternet says:

    Name should be the first field that is extracted!?

  3. stylifyyourblog says:

    This is just amazing , thanks for such a script , a true time saver

  4. Gowtham says:

    Didn’t get Names, the script was able to extract all the numbers to a CSV file.

    • mginternet says:

      Please Open you nbu file as a text file, and look for the Begin VCARD text. Underneath there you should see a version and below that a Name.

      N:;This is the Name;;;

      I need to know what’s in front of the name (in this case it’s N: ) and what is the version number (2.1).

  5. Jose says:

    Great! Thanks!

  6. deepak says:


  7. aliuzair133 says:

    output csv file doesnt show the contact name, my nbu file has contact saved as shown below.

    • mginternet says:

      Thanks for the VCARD, I belive I have now corrected the problem with names, the script above has been updated.

      Please try it and let me know if it worked.

  8. Rameshwar says:

    Very helpful script, thank you very much..
    Excellent thing is we can modify script, if we have little programming knowledge..

  9. aliuzair133 says:

    script only got the number and no names,

  10. Wow that was unusual. I just wrote an very long comment but
    after I clicked submit my comment didn’t appear. Grrrr… well I’m not writing all that over again.
    Anyways, just wanted to say fantastic blog!

  11. Pinal says:

    Hats off to MGINTERNET…….
    I have been researching since morning to get my issue resolved.
    And you did it with ease.
    Thank you MGI.

  12. Mehboob says:

    Thanks a lot …….its just takes 2 minutes….

  13. belarus says:

    thanx a lot!)

  14. man this is really smart ! searched around so much couldn’t find anything useful. this is simple and quick. thanks alot

  15. Judith says:

    Hello! I did exactly what you explain but I got an error message:
    Line: 13
    Char: 1
    Error: file not found
    Code: 800A0035
    Source: Microsoft VBScript runtime error
    The file “Output.csv” has been created in the same directory but it is empty (only the titles of the columns appear)
    Any advice?
    Thanks ahead!

    • mginternet says:

      Hi, you “.nbu” file from the Nokia phone must be in the same directory as the script file, and it MUST be call file.nbu

      • Judith says:

        Thanks a lot for your quick answer, but It is exactly what I did…The file ‘file.nbu’ is in the same directory as the script…
        Any other guess?

      • mginternet says:

        Just double check that the file name has no spaces in it, or that it’s not hiding another extension (so it not called file.nbu.txt and the txt bit is hidden). Try moving the files into their own folder and run it again.

        The error you’re getting is the script saying it can’t file the file.nbu – so it must be to do with its name or location….

        Good Luck.

  16. Matei says:

    Thanks! Thanks! Thanks! Where can I donate ?

  17. Matei says:

    on some nbu files i’ve got this error,
    line: 31
    Char: 5
    Error: Subscript out of range : ‘[number: 1]’
    Code: 800A0009

    many, many thanks in advance!

    • mginternet says:


      Thanks for the comments, I’ve updated the script to allow two types of names fields and blank names (if they exsit). One of which I think was causing your problem. Copy the new script and try again…please could you let me know if it solves the Issue?


  18. Veronica says:

    Hello is not showing names for me eather:


    I’m from Ecuador and my carrier added 1 more digit to cell phone numbers and to add it to all the contacts they have released 1 poor application and it only takes .csv file :(. I need this fixed for my mom, i own an Android smartphone so that’s not biggie.

    Thanks in advance!

    • mginternet says:


      I’ve updated the file again, I’ve begin to think the Diffent NBU files need different converter.Have a ago with the updated files and see if it solves the issue.

  19. Kapil says:

    thanks a ton dude 🙂

  20. Eddy says:

    Great code! Thanks a lot!

  21. Fred Dagg says:

    Cheers. Thanks for your efforts.

  22. Squelch says:

    That was just waycool man!…works a treat fr me – neat as a pin. Thx heaps for your time

  23. Opterron says:

    Even better! Thank you!

  24. Jay says:

    Hi – just trying to get this working for my mom… receive a script error Line 13, char 46, expecting ‘)’.
    Any idea how to solve?

    Many thanks!

  25. mginternet says:

    Make sure on line 13 there is the same number of closing brackets ) as opening Brakes (……Just add “)” that on at then end of line 13!

    which should be

    set Userlist = fso.openTextFile(“file.nbu”,1)

    • sam says:

      Hi! I have same error with line 13 char 46. add missed “)” – (“file.nbu”,1) but now it write- error Line 13, char 47 , assumes a completion instructions. can you write the correct version of line 13? Sry for my engl.
      tnx in advance

  26. Sonnel says:

    I’ve same Jay’s error.
    Script Line 13
    set Userlist = fso.openTextFile(“file.nbu”,1 Report = fso.OpenTextFile(“Output.csv”,8,1ort.writeline(“Name,Mobile Phone,Home Phone,Business Phone,Company,Job Title,Car Phone”)

    Could you please write correct Line 13.

  27. mginternet says:

    it should look like this….as above (all on separate lines)!

    set Userlist = fso.openTextFile(“file.nbu”,1)

    Set Report = fso.OpenTextFile(“Output.csv”,8,1)

    report.writeline(“Name,Mobile Phone,Home Phone,Business Phone,Company,Job Title,Car Phone”)

  28. Alex Mathew says:

    Thanks this code saved me a lot of time.. As for the errors in the codes.. Its just the garbage characters that comes along while copying. specially the double inverted quotes. The three lines as mentioned above while get you there

  29. Alex says:

    Thank you for leading the way. It is about time to say farewell to the old trustworthy Nokia and then converting contact data can be a big hurdle. I found inspiration on your site and got it done. I did make some code adaptations I’d like to share. Please send me an email so I can reply and provide you with the code. If you like the changes hopefully to share via the site.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s