Giter Club home page Giter Club logo

contacts-exporter's Introduction

Contacts Exporter

This is a Python script to export contacts from the macOS Contacts app in vCard format to Markdown files with structured data. The script is compatible with Python 3.

Installation

Clone this repository or download the script file main.py.

This script requires the vobject and dateutil Python packages. To install them, run:

pip3 install vobject python-dateutil

Usage

  1. Open the Contacts app on your macOS.
  2. Create or select a contact group that you want to export.
  3. Open a terminal window and navigate to the directory where you saved main.py.
  4. Run the script with python3 main.py.

By default, the script exports the contacts from a default "Obsidian" group and saves the Markdown files in the "๐Ÿ“‡ Contacts" folder. You can customize these settings by setting the CONTACT_GROUP and OUTPUT_FOLDER environment variables, respectively.

Output

The script exports each contact as a Markdown file with the following structure:

## ๐Ÿ‘ค Name
- ๐Ÿ“ง Email: [[email protected]](mailto:[email protected])
- โ˜Ž๏ธ Phone: [+1 (555) 123-4567](tel:+15551234567)
- ๐ŸŽ‚ Birthday: [[20000101]]
- ๐Ÿ’ Anniversary: [[20100101]]
- ๐Ÿข Organization: Example Inc.
- ๐Ÿ“ Note: Some notes about the contact.
- ๐ŸŒ Website: [example.com](http://example.com)
- ๐Ÿ“ Location: 37.7749ยฐ N, 122.4194ยฐ W
- ๐Ÿ’ผ Role: Some role
- ๐Ÿ“› Title: Some title
- โ™€๏ธ Gender: F
- ๐Ÿ—ฃ๏ธ Language: English
- ๐Ÿ  Address: 123 Main St, Suite 100, San Francisco

The script supports the following vCard fields:

  • fn
  • email
  • tel
  • bday
  • x_anniversary
  • org
  • note
  • url
  • geo
  • role
  • title
  • x_gender
  • lang
  • adr

Notes

If a vCard field is not present in a contact, the corresponding section will not be included in the Markdown file.

The script replaces any illegal characters (\, /, *, ?, :, ", <, >, |) in the contact name with underscores (_) to avoid issues with file naming.

contacts-exporter's People

Contributors

felixchenier avatar jhgee avatar sidedwards avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

contacts-exporter's Issues

Have multiple Phone Numbers exported?

Hi, I love your script, and I modified it a bit. - I have everything also as Metadata written into frontmatter.

I have tried a bit... but many of my contacts have more than one phone number, privat, business, cell... most of them:

TEL;type=CELL;type=VOICE;type=pref:+44xxx
TEL;type=WORK;type=VOICE:+44xxxx

Your script will only take care of the first TEL entry in the VCard. I wonder if that could be modified to export more than one?

Simliar challange with ADR - I have a work and home address...

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.