Skip to content

📠 A script that parses a .csv file from the ASV-Amtliche Schulverwaltung of contacts and automatically creates vCards

License

Notifications You must be signed in to change notification settings

Trinity503/asv2vcard

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

asv to vcard

This script produces vcard-files in the export directory. The Input-File is generated by the ASV, the "Amtliche Schulverwaltung" of Bavaria. You can download the file "asv2vcard.exf" and import it into the ASV or create an "Exportformat" with the fields Familienname Rufname Telefonnummer Handynummer Skript 5 Skript 6 Skript 7

where Skript 5 is a script to generate the private E-Mail in the necessary format:

if (obj?.lehrerStamm.kommunikationen != null) {
   // Feldwert zurückgeben
    def pattern = /Mail priv. - \S+@\S+\.\w{2,}/
    def match = obj?.lehrerStamm?.kommunikationen =~ pattern
    if (match.find()) {
        def adresse = /\S+@\S+\.\w{2,}/
    def privat = match[0] =~ adresse
    def email = privat[0]
    }
    else {def email = ""}
} else {
   // Entwertungszeichen oder Text zurückgeben
   def email = ""
}

where Skript 6 is a script to generate the work E-Mail in the necessary format:

if (obj?.lehrerStamm.kommunikationen != null) {
   // Feldwert zurückgeben
    def pattern = /Mail dstl. - \S+@\S+\.\w{2,}/
    def match = obj?.lehrerStamm?.kommunikationen =~ pattern
    if (match.find()) {
        def adresse = /\S+@\S+\.\w{2,}/
    def privat = match[0] =~ adresse
    def email = privat[0]
    }
    else {def email = ""}
} else {
   // Entwertungszeichen oder Text zurückgeben
   def email = ""
}

where Skript 7 is a script to generate the birthdate in the necessary format:

if (obj?.lehrerStamm.geburtsdatum != null) {
   // Feldwert zurückgeben
    def bday = obj?.lehrerStamm?.geburtsdatum.format("yyyy-MM-dd")
} else {
   // Entwertungszeichen oder Text zurückgeben
   def bday = ""
}

image

Usage

python3 asv2vcard.py export.csv

This script is based on the following script:

Downloads

csv2vcard

A Python script that parses a .csv file of contacts and automatically creates vCards. The vCards are super useful for sending your contact details or those of your team. You can also upload them to e.g. Dropbox and use them with QR codes! You can also use them for transferring new contacts to Outlook, a new CRM etc. The specific use case in mind was to programmatically create vCards from a list of contacts in a spreadsheet, to be incorporated into business cards.

Usage

  1. Install package with pip3 install csv2vcard

  2. Create csv file with contacts

CSV file format (delimeter can be changed in csv_delimeter param, see below)

last_name, first_name, org, title, phone, email, website, street, city, p_code, country

Important: you should name the columns exactly the same way because they are used as keys to generate the vCards

  1. cd yourcsvfoldername go to the folder where you have your csv file

  2. Open python python3 (gotcha: using Python 3.6 features)

  3. Import module from csv2vcard import csv2vcard

  4. Now you have 2 options for running (both will create an /export/ dir for your vCard):

  • Test the app with csv2vcard.test_csv2vcard(). This will create a Forrest Gump test vCard.
  • Use your real data csv2vcard.csv2vcard("yourcsvfilename", ",") where "," is your csv delimeter. This will create all your vCards.

About

📠 A script that parses a .csv file from the ASV-Amtliche Schulverwaltung of contacts and automatically creates vCards

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%