+ Reply to Thread
Results 1 to 7 of 7

Import VCard (.vcf) file

  1. #1
    Forum Contributor
    Join Date
    01-20-2014
    Location
    Greece
    MS-Off Ver
    20 yr. old Excel 2002!
    Posts
    710

    Import VCard (.vcf) file

    Hi

    I would like a macro to import a VCard file.
    Items to import are
    Last Name
    First Name
    Middle Name
    Title (Mr., Ms., Dr. etc)
    Company Name if any
    Job Title if any
    and all phone numbers listed STRIPPED OF ANY NON NUMERICAL CHARACTERS EXCEPT "+" BEFORE THE COUNTRY CODE.
    EDIT: (Including parentheses, dashes, spaces)

    I am attaching 4 sample VCard files and a Workbook with more detailed info.

    Tried without satisfaction:
    https://sourceforge.net/projects/vcf-to-xls/
    https://sourceforge.net/projects/bulkvcftocsv/
    https://www.excelforum.com/excel-gen...ighlight=vcard

    THANK YOU
    Attached Files Attached Files
    Last edited by drgkt; 06-11-2022 at 06:22 AM.

  2. #2
    Forum Contributor
    Join Date
    02-25-2022
    Location
    Dallas, Texas
    MS-Off Ver
    Office 365
    Posts
    174

    Re: Import VCard (.vcf) file

    If I was doing this I would use regular expressions to extract data (example). For example this:

    Please Login or Register  to view this content.
    would extract

    N:LastName;FirstName;MiddleName;Title;Suffix

    You really need to provide real examples. For example an Outlook vcf file has Name like this:

    BEGIN:VCARD
    VERSION:2.1
    N;LANGUAGE=en-us:Doe;John

  3. #3
    Forum Contributor
    Join Date
    01-20-2014
    Location
    Greece
    MS-Off Ver
    20 yr. old Excel 2002!
    Posts
    710

    Re: Import VCard (.vcf) file

    These are real examples taken from 2 phones and their Myphone Explorer backup.
    I just replaced the data with fake.

  4. #4
    Forum Contributor
    Join Date
    01-20-2014
    Location
    Greece
    MS-Off Ver
    20 yr. old Excel 2002!
    Posts
    710

    Re: Import VCard (.vcf) file

    @mogul: I took a look at the page you suggested but I cannot understand much. Perhaps you can submit a work book with the relevant code.

    I think most who tried to do this, they are starting out with a set column number, then try to sort into these the data from the vCard and at the end they ask if the user wishes to keep empty columns.

    I also think that it is better that the column is created when reading the vCard data. At that point if the column label does not exist, create it, if it exists, place the data, if it exists and data is already placed while processing this record, create a second (when record has to numbers with the id "CELL" one number will go to column CELL and the other in CELL (2)).

    Anyone?

  5. #5
    Forum Contributor
    Join Date
    02-25-2022
    Location
    Dallas, Texas
    MS-Off Ver
    Office 365
    Posts
    174

    Re: Import VCard (.vcf) file

    I created an example program that extracts the name row in vcf and puts it in spreadsheet. You'll need to adapt it to read all vcf's and generate numerous regular expressions to extract other values. I use the website regex101.com. It is excellent to create regex's. It is actually fun to do. There a numerous regular expressions tutorials on Youtube. It will take a lot of effort and determination to get this done.

    Please Login or Register  to view this content.
    RegexVCF.png
    Attached Files Attached Files
    Last edited by mogul; 06-12-2022 at 07:08 PM.

  6. #6
    Forum Contributor
    Join Date
    01-20-2014
    Location
    Greece
    MS-Off Ver
    20 yr. old Excel 2002!
    Posts
    710

    Re: Import VCard (.vcf) file

    @ Mogul: Sincere thanks for taking the time addressing this issue but I am unable to follow. (Cannot teach old dog (70) new tricks!).

    I came accross the code in attached workbook which merely "transposes" the contents of the vCard from vertical to horizontal without separating the input in column header and data. (Just tename the .txt to .vcf, put the 2 files in the same folder and run the macro).

    Could this be a starting point? Can a code use this to finally deliver what is expected?

    Given the apparent difficulty of the task, let us make some compromises:

    A. The data we are after is:
    From the line starting with "N:" The title, first, middle and last name.
    All lines that start with TEL.
    And the lines starting with "ORG" and "TITLE".

    B. The column header (Label) will be the entire respective vCard line before the last colon ":" Example "TEL;TYPE=CELL"
    If an entry of the vCard has 2 or more of "TEL;TYPE=CELL", 2 or more columns with the same label will be created. (No need to make the 2nd "CELL (2)" etc.

    The challenge will be to correctly put the data of each vCard record to the right column.
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    02-25-2022
    Location
    Dallas, Texas
    MS-Off Ver
    Office 365
    Posts
    174

    Re: Import VCard (.vcf) file

    My only other suggestion is to import vfc files into Outlook and export a CSV file of contacts. All values will be in columns.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Import a text file via macro, then select and import certain data.
    By jamesrawlinson in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 05-31-2022, 10:52 AM
  2. How to convert Excel to Vcard?
    By Kevincolin in forum Excel General
    Replies: 2
    Last Post: 03-12-2020, 03:11 AM
  3. How to convert Excel to VCard or XLS, XLSX to VCF?
    By Austin05 in forum Excel General
    Replies: 3
    Last Post: 01-17-2020, 06:28 AM
  4. How to Convert CSV to Vcard file Format ?
    By Thomas205 in forum Excel General
    Replies: 2
    Last Post: 02-04-2019, 12:51 AM
  5. hyperlink outlook Vcard in Excel
    By Christianpaquet in forum Excel General
    Replies: 0
    Last Post: 02-01-2014, 11:35 AM
  6. File import - select file and import sheet(1) from closed workbook
    By Armitage2k in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-22-2011, 03:15 AM
  7. Text file from vcard
    By leiheff in forum Excel General
    Replies: 2
    Last Post: 08-14-2009, 11:43 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1