Google Contacts の連絡先を Outlook にインポートした。その際、Outlook で宛先候補がアルファベットの姓ないし名で列挙されるよう Google CSV 形式でエクスポートしたファイルを Outlook CSV 形式に変換した。ちなみに、単純に Outlook CSV 形式にエクスポートすると、これには「よみがな」が含まれないので、姓ないし名を漢字で入力しないと宛先候補が出力されない。
これを行う Python のコードは以下の通りである。筆者が Google Contacts で使用しているフィールドに特化しているので、コード中の [g|c]_cols
を参照しつつ事情に合わせて加減されたい。
不思議な事に Outlook のデスクトップアプリケーションでは outlook_form.csv
の読み込みに失敗するので Outlook.com でインポートする必要がある。
import pandas as pd
# g_cols = [
# "Name","Given Name","Additional Name","Family Name",
# "Yomi Name","Given Name Yomi","Additional Name Yomi",
# "Family Name Yomi","Name Prefix","Name Suffix",
# "Initials","Nickname","Short Name","Maiden Name",
# "Birthday","Gender","Location","Billing Information",
# "Directory Server","Mileage","Occupation","Hobby",
# "Sensitivity","Priority","Subject","Notes","Language",
# "Photo","Group Membership","E-mail 1 - Type",
# "E-mail 1 - Value","E-mail 2 - Type","E-mail 2 - Value",
# "Phone 1 - Type","Phone 1 - Value","Phone 2 - Type",
# "Phone 2 - Value","Address 1 - Type","Address 1 - Formatted",
# "Address 1 - Street","Address 1 - City","Address 1 - PO Box",
# "Address 1 - Region","Address 1 - Postal Code",
# "Address 1 - Country","Address 1 - Extended Address",
# "Organization 1 - Type","Organization 1 - Name",
# "Organization 1 - Yomi Name","Organization 1 - Title",
# "Organization 1 - Department","Organization 1 - Symbol",
# "Organization 1 - Location","Organization 1 - Job Description"
# ]
o_cols = [
"First Name","Middle Name","Last Name","Title","Suffix",
"Initials","Web Page","Gender","Birthday","Anniversary",
"Location","Language","Internet Free Busy","Notes",
"E-mail Address","E-mail 2 Address","E-mail 3 Address",
"Primary Phone","Home Phone","Home Phone 2","Mobile Phone",
"Pager","Home Fax","Home Address","Home Street",
"Home Street 2","Home Street 3","Home Address PO Box",
"Home City","Home State","Home Postal Code","Home Country",
"Spouse","Children","Manager's Name","Assistant's Name",
"Referred By","Company Main Phone","Business Phone",
"Business Phone 2","Business Fax","Assistant's Phone",
"Company","Job Title","Department","Office Location",
"Organizational ID Number","Profession","Account",
"Business Address","Business Street","Business Street 2",
"Business Street 3","Business Address PO Box","Business City",
"Business State","Business Postal Code","Business Country",
"Other Phone","Other Fax","Other Address","Other Street",
"Other Street 2","Other Street 3","Other Address PO Box",
"Other City","Other State","Other Postal Code","Other Country",
"Callback","Car Phone","ISDN","Radio Phone","TTY/TDD Phone",
"Telex","User 1","User 2","User 3","User 4","Keywords","Mileage",
"Hobby","Billing Information","Directory Server","Sensitivity",
"Priority","Private","Categories"
]
google = pd.read_csv("google_form.csv", encoding="utf-8")
google = google.dropna(subset=["E-mail 1 - Value"])
outlook = pd.DataFrame(columns=o_cols)
outlook["First Name"] = google["Given Name Yomi"] # been entering in alphabet
outlook["Last Name"] = google["Family Name Yomi"] # do
outlook["Title"] = google["Name"]
outlook["E-mail Address"] = google["E-mail 1 - Value"]
outlook["E-mail 2 Address"] = google["E-mail 2 - Value"]
outlook["Home Phone"] = google["Phone 1 - Value"]
outlook["Home Phone 2"] = google["Phone 2 - Value"]
outlook["Home Address"] = google["Address 1 - Formatted"]
outlook["Home Street"] = google["Address 1 - Street"]
outlook["Home City"] = google["Address 1 - City"]
outlook["Home State"] = google["Address 1 - Region"]
outlook["Home Postal Code"] = google["Address 1 - Postal Code"]
outlook["Home Country"] = google["Address 1 - Country"]
outlook["Company"] = google["Organization 1 - Name"]
outlook["Department"] = google["Organization 1 - Department"]
outlook.to_csv('outlook_form.csv', encoding="utf_8", index=False)