Import multiple VCF contacts into Gmail with Windows 7

One of rather frequent tasks is import of existing contacts from other sources into newly created Gmail account.

There are lot of tools (Gmail offer that as well) for two-way synhronization between various applications (Outlook and such), but one time, one way (Desktop -> Gmail) is not covered very well.

So, task is simple: import multiple VCF (vCard) contacts into Gmail contacts.

I will use Windows Contacts as an example inside Windows 7 (Nokia PC Suite can synhronize contacts in your phone with Windows Contacts) but procedure can be applied to any set of *.vcf files.

Get Windows Contacts into *.vcf format

  • Open Windows Contacts
  • Select “Organize / Select All
  • Select Export
  • Select “vCards (folder of .vcf files)
  • Click on Export

You will be asked to select folder where all contacts wil be exported as .vcf files:

Windows Contacts - VCF export

Let’s assume that you created new folder Cards on C: drive and exported *.vcf there. Also, create another subfolder of Cards folder – Final.

So, new structure is C:CardsFinal with bunch of *.vcf files into C:Cards

Combine all *.vcf files into one big file

Next step is to combine all *.vcf files into one big file.

Open Windows Explored and locate C:Cards. Press and hold Shift key and right-click with mouse anywhere in folder and select option “Open command window here“:

Open command window here

Don’t get scared by black window you got; you need to type just one short command:

copy /b *.vcf FinalBig.Vcf

Merge multiple files

You can close command windows after this.

If you are English speaking person and have no strange characters in names of your contacts, you can stop here – use C:CardsFinalBig.vcf as source of import in Gmail Contacts and you are fine.

However, most of us non-English speaking should do final step: proper conversion of file.

Convert big vcf file into UTF8

We will use Powershell for this final step.

Press Start, type Powershell and select Windows PowerShell. Now you will be presented with blue 🙂 screen. Type following sequence of commands, pressing Enter on end of every line (or do copy / paste)

cd CardsFinal
get-content "Big.Vcf" | out-file -encoding "UTF8" -filepath "ConvertedBig.Vcf"

Powershell - UTF8 conversion

That is it – import your file C:CardsFinalConvertedBig.Vcf into Gmail contacts 🙂

Scripting Man’s best friend – PowerShell

In the world of GUI, at the heart, I am still scripting / command line / shell man.

No matter how GUI application is built, there can be no efficiency and repeatability like in a powerful, versatile script.

In the beginning, there was DOS. Than simple Command processor of Windows 95/98 (I resisted of installing Windows ME, thank God for that). Than, enlightenment – JP‘s 4Dos (retired) and 4NT – the way CMD should be from start. 4NT was breakthrough in my productivity – backup, maintenance, monitor scripts; processing of folders and files; automating each and every boring repeatable action. Add on top of that AWK for really complicated stuff and there was no problem without solution.

Microsoft was aware about all of shortcomings of CMD shell and tried to overcome them introducing Windows Scripting Shell; however, that approach simply was not successful.

Than MS started to work on Microsoft Shell or MSH (codenamed Monad), and first public beta was in September 2005. Finally, they renamed it to Windows PowerShell and build one of the most powerful scripting system for all kinds of tasks – from simple file operations to management of domains and networks. With PowerShell you can manage files, folders, remote locations, registry items, COM objects …

Let’s see how dir command does both in PS and CMD:

PowerShell dir command

What is the difference? (apart from obvious: colors and different way of displaying information) Real difference is that result of the CMD dir command are lines of text and result of PS dir command are objects; objects which you can query for attributes and to decide what to do next based on attribute values.

  • Commands are not text-based – they deal with objects
  • Command family is extensible – native binary commands, cmdlets (pronounced command-lets) can be augmented by cmdlets that you create

For example, to find out all properties of objects returned with dir, execute:
dir | get-member

By the way, dir is not real name for cmdlet – it is just an alias:

PowerShell Get-Alias dir

You can create your own aliases using the Set-Alias cmdlet.

Just one important thing if you plan to dive into PowerShell scripts world:

In order to create and use scripts, instead of just inline commands, you need to deal with security. More info can be obtained with
* get-help about_signing | more
* get-help Set-AuthenticodeSignature -detailed | more

(or redirect this to file and read afterwards)

(basic help can be obtained for any cmdlet with “-?“; detailed help can be obtained with “get-help cmdlet-name“)

Almost forgot – real reason for this post was that PowerShell reached version 1.0 and it is availabile for download.