Export VCF to Excel in C#

I recently needed to rescue contact data stored in a .vcf file (vCard) and export it into Excel.

As I did not want to spend much time on this work, I searched and found this C# solution on Code Project which reads VCF 2.1 files.

After a couple of modifications, the program was able to parse VCF 3.0 files, display the contents of the file in a multi-line text control, and copy the contents to the clipboard.

In Excel, the clipboard data can be pasted and the result saved as .xls or .xlsx file.

While the solution now works for my purposes (i.e. reading a VCF file and extracting contacts, phone numbers and address, email addresses, and websites), the code does not parse the full contents of a VCF file, and does not write a VCF file.

The original author was aware of some shortcomings of his solution, and so am I.

If I wrote a parser/writer from scratch, my solution would retrieve the data into dictionaries (1 per contact), and implement accessor properties to retrieve and store the requested data.

Nevertheless, if you want a simply data retrieval tool to copy existing data into an Excel sheet, the solution is good enough.

As it is derived work, the source code (C#, Visual Studio 2008) is licensed under the Code Project Open License, and can be downloaded here.

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 )

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.