Code Monkey home page Code Monkey logo

vcard2csv_clone's Introduction

vCard to CSV

Author: Nathaniel Beaver

This is a Python 2/3 script to turn a directory full of vCard files into a single CSV file. It can also be imported and used as a module.

Not all of the vCard fields are preserved; currently only these fields:

  • Name
  • Cell phone
  • Work phone
  • Home phone
  • Email
  • Note

(I used this to convert vCards from an old LG Rumor 2 cell phone, so I have not needed to extract additional fields.)

Dependencies

If you encounter an error like this (Python 2):

Traceback (most recent call last):
  File "vcard2csv.py", line 2, in <module>
    import vobject # to parse vCard (vcf) files
ImportError: No module named vobject

or this (Python 3):

Traceback (most recent call last):
  File "vcard2csv.py", line 2, in <module>
    import vobject
ModuleNotFoundError: No module named 'vobject'

then you need to install the python vobject library, which you can do with pip:

pip install --user vobject

It is also in the major package managers.

https://src.fedoraproject.org/rpms/python-vobject

https://launchpad.net/ubuntu/+source/python-vobject

https://tracker.debian.org/pkg/python-vobject

https://security.archlinux.org/package/python-vobject

https://software.opensuse.org/package/python-vobject

https://software.opensuse.org/package/python2-vobject

https://software.opensuse.org/package/python3-vobject

Usage

The vCard files must have the suffix .vcf. Simply run the script in the directory containing the vCard files and specify the output filename:

python vcard2csv.py . foo.csv

Or point the script at a directory containing the .vcf files:

python vcard2csv.py example-vcards foo.csv

For additional help and options, pass the -h flag:

python vcard2csv.py -h

The script is compatible with both Python 2 and Python 3.

Bugs

Only a few of the vCard fields are preserved; this may be undesirable.

vCard version 4.0 has not been implemented, though it would probably be straightforward to do so.

See the to-do list for more.

License

This project is licensed under the terms of the MIT license.

vcard2csv_clone's People

Contributors

ellache avatar nbeaver avatar willthemoor avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.