khard icon indicating copy to clipboard operation
khard copied to clipboard

How to import contacts from existing databases?

Open poetaman opened this issue 5 years ago • 2 comments

Can you please add steps needed to import contacts from existing databases? Am looking forward to import contacts from macOS in-built Contacts app. I can select all contacts, and export them as one "vcards" file. Not sure how to import it using Khard. I mean there should be an option to say khard --import <filename or directory_name>

poetaman avatar Feb 21 '21 22:02 poetaman

As described in the docs you will need to have the contacts from your existing database in individual vcard files. One big file with many vcards is not supported.

If our underlying vobject library supports single files with many vcard objects inside an import function should be possible to implement. The import command could accept input in vcard format and normalize them (add a uid e.g.) as well as vaddressbook I would be open for pull requests.

There has been some discussion about this before: #252

lucc avatar Feb 22 '21 14:02 lucc

https://github.com/jakeogh/vcardtool will split a multiple record vcf into individual files.

It vcardtool encounters VERSION:2.1 records (which cause the warning messages in #279) it suggests preprocessing the input file with https://github.com/jowave/vcard2to3.

vcardtool will also insert a UID field if necessary to address issue #288.

jakeogh avatar Oct 20 '21 23:10 jakeogh

As I was setting up khard for managing my email client contacts, I also faced the issue of splitting my vcf files, but before I could find this issue, I had written a python script to do it (vcf-splitter for the record).

My point is: shouldn't the docs be updated to mention some scripts for splitting existing vcf files? I can create a PR with a modified version of i.e. doc/source/scripting.rst referencing the tools mentioned in this issue.

rogarb avatar Feb 02 '23 09:02 rogarb

@rogarb PR welcome!

lucc avatar Feb 02 '23 17:02 lucc

@poetaman I will close this as #317 is merged.

If someone still needs a new subcommand in khard they can use vobject.readComponents and send a PR.

lucc avatar Feb 03 '23 11:02 lucc