Compare Two vCard Files

I synchronized my Google Contacts with macOS Contacts and it worked pretty well but the counts are different so I want to see what exactly the difference is. The backstory is here:

I want to find out which contacts are different between the two contact managers. More specifically, I’d like to know which contacts are in one and not in the other.

@Shamino suggested that I export the contents of each manager to a common text file format and compare the two files. I can’t figure out a way to export macOS Contacts to CSV—can you?—so the only common format is vCard version 3.

Unfortunately …

Apparently there are many variations in the vCard 3 specification so a simple text comparison will flag lots of differences that are not meaningful to me.

All I really want to know is which contacts are in one file and not in the other.

Can anyone suggest a simple way to do this vCard comparison?

Thank you.

UPDATE 2022-01-29 ∼9am CST
This page discusses two ways to export macOS contacts to a CSV.

UPDATE 2022-01-29 ∼1pm CST
The app referred to in the above article, AB2CSV, does NOT work. It ran for over 2½ and never produced the CSV file. I tried another from the macOS App Store, Exporter for Contacts 2, and it also failed.

Maybe you could edit out irrelevant fields from the vcard files. For example, you could make a list of only the names. That should be easier to compare.

Here’s one way to do that in BBEdit:

  • Open the vcard file in BBEdit.
  • Use Text > Process Lines Containing…
  • Enter “^FN:”; Check “Grep” and “Copy to new document”: image
  • This will give you a new document containing a list of Full Names.
  • Do this with both vcard files, and you can compare the name lists right there in BBEdit using Search > Find Differences
1 Like

@jajvj1

Thank you. That was a very good idea.

I’m a bit late to this, but I’m surprised Exporter for Contacts 2 didn’t work for you. I’ve used Exporter for Contacts for years (since before it had a “2” at the end of its name) and it has always worked well for me. I don’t do anything too demanding, but it seems pretty robust, and the developer is very responsive. What was the error you were getting when you tried to use it?

I thought that I had posted an update, but apparently I did not. My apologies to the thread.

Yes, Stefan Keller, the developer of Exporter for Contacts 2 is very responsive. As I posted in my review on the App Store:

I couldn’t get this app to work and filed a bug report with the developer at 12:47pm (my time) and a fix (ver 2.1.1) was in the App Store by 2:36am (my time) the next day. Amazing turnaround.

Apparently, Exporter for Contacts 2 never wrote the results file because it couldn’t write to a volume other than the one it launched from. My iMac has two internal drives, an SSD for macOS and apps, and a HDD for all data files. So, it launched from the SSD and I was trying to write the results to my HDD.

Once fixed, I used Exporter for Contacts 2 to export a CSV file from macOS Contacts that I compared to a CSV export from Google Contacts. Using BBEdit, as suggested by @jajvj1, I extracted just the full name from each CSV file and looked for contacts that were in one file and not the other. In the end, I convinced myself that each file had exactly the same entities, despite the different counts that the applications gave. It was an extremely laborious process to compare over 6,000 rows of data by eyeball. In hindsight I could have automated it more and it would have been much easier.

Thank you for following up on my little adventure.

2 Likes

Thanks for the update, and glad you got it sorted. And that you had a similarly good experience with the Exporter developer. :blush: