将 CSV 联系人导入 Android 4 手机

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11300233/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 06:49:21  来源:igfitidea点击:

Import CSV contacts into Android 4 phone

androidcsvimportcontactsandroid-4.0-ice-cream-sandwich

提问by rubo77

I have a CSV-file with all my contacts (exported from Thunderbird).

我有一个包含所有联系人的 CSV 文件(从 Thunderbird 导出)。

On my Phone I have Android 4 ice cream sandwich installed.

在我的手机上,我安装了 Android 4 冰淇淋三明治。

How can I import the contacts from the CSV-File into my Android cellphone (sony ericson Xperia Ray) without using any "spyware" (google, facebook, outlook, etc.)?

如何在不使用任何“间谍软件”(google、facebook、outlook 等)的情况下将 CSV 文件中的联系人导入我的 Android 手机(索尼爱立信 Xperia Ray)?

采纳答案by Jon

Here's the Windows-only version of rubo77's solution:

这是 rubo77 解决方案的仅 Windows 版本:

  1. Import the csv-list into the Windows 7 Contacts. (remember you can only use the Windows contacts fields once per csv field)

  2. Export the Windows Contacts into single VCF-Cards.

  3. Glue them all together into one large vcf file:

    type *.vcf>..\all_adresses.vcf

  4. Convert all_adresses.vcf to UTF-8 so the special characters are correct:

    Open all_adresses.vcf in Notepad++, click Encoding > Encode in UTF-8. Save.

  5. Import them into android Phone (in Contacts there is an option to import from SD-Card)

  1. 将 csv-list 导入 Windows 7 联系人。(请记住,每个 csv 字段只能使用一次 Windows 联系人字段)

  2. 将 Windows 联系人导出到单个 VCF 卡中。

  3. 将它们全部粘合成一个大的 vcf 文件:

    type *.vcf>..\all_adresses.vcf

  4. 将 all_adresses.vcf 转换为 UTF-8,以便特殊字符正确:

    在 Notepad++ 中打开 all_adresses.vcf,单击编码 > 以 UTF-8 编码。节省。

  5. 将它们导入 android 手机(在通讯录中有一个从 SD 卡导入的选项)

回答by rubo77

I tried a lot and finnally i found a solution that works without google!

我尝试了很多,最后我找到了一个无需 google 即可工作的解决方案!

  1. I imported my csv-list into the Windows 7 Contacts. (it's easy if you adjust the first line with the correct fieldnames)

  2. then I exported them from there into single VCF-Cards.

  3. I glued them all together into one large vcf file:

    cat *.vcf>../all_adresses.vcf

  4. convert them to UTF-8 so the special characters are correct:

    iconv --from-code=ISO-8859-1 --to-code=UTF-8 all_adresses.vcf > all_adresses_correct.vcf

  5. finally I imported them in my android Phone (in Contacts there is an option to import from SD-Card)

  1. 我将我的 csv 列表导​​入到 Windows 7 联系人中。(如果您使用正确的字段名调整第一行,这很容易)

  2. 然后我从那里将它们导出到单个 VCF 卡中。

  3. 我将它们全部粘在一个大的 vcf 文件中:

    cat *.vcf>../all_adresses.vcf

  4. 将它们转换为 UTF-8,以便特殊字符正确:

    iconv --from-code=ISO-8859-1 --to-code=UTF-8 all_adresses.vcf > all_adresses_correct.vcf

  5. 最后我将它们导入到我的 android 手机中(在通讯录中有一个从 SD 卡导入的选项)

if you delete them from your windows contacts after you are done, I think no traces of your addresses are left on the computer.

如果您在完成后从 Windows 联系人中删除它们,我认为您的地址不会在计算机上留下任何痕迹。

回答by UnX

This is a dirty fix but it worked for me (on Linux although cygwin could be used on Windows env) :

这是一个肮脏的修复,但对我有用(在 Linux 上,尽管 cygwin 可以在 Windows env 上使用):

  1. Export your contact in Thunderbird as CSV using commas.
  2. File format is like this :
  1. 使用逗号将您在 Thunderbird 中的联系人导出为 CSV。
  2. 文件格式是这样的:

First Name,Last Name,Display Name,Nickname,Primary Email,Secondary Email,Screen Name,Work Phone,Home Phone,Fax Number,Pager Number,Mobile Number,Home Address,Home Address 2,Home City,Home County,Home Post Code,Home Country,Work Address,Work Address 2,Work City,Work County,Work Post Code,Work Country,Job Title,Department,Organisation,Web Page 1,Web Page 2,Birth Year,Birth Month,Birth Day,Custom 1,Custom 2,Custom 3,Custom 4,Notes,

名字、姓氏、显示名称、昵称、主要电子邮件、辅助电子邮件、用户名、工作电话、家庭电话、传真号码、寻呼机号码、手机号码、家庭住址、家庭住址 2、居住城市、居住县、家庭邮政代码,原籍国,工作地址,工作地址 2,工作城市,工作县,工作邮政编码,工作国家,职位,部门,组织,网页 1,网页 2,出生年份,出生月份,生日,自定义1,自定义 2,自定义 3,自定义 4,注意事项,

In my case most the entries contain only First Name,Last Name,Display Name,,Primary Email.

在我的情况下,大多数条目仅包含First Name,Last Name,Display Name,,Primary Email

So I used sed to convert each entry to VCF 2.1 format :

所以我使用 sed 将每个条目转换为 VCF 2.1 格式:

BEGIN:VCARD
VERSION:2.1
N:LastName;FirstName
FN:FirstName LastName
EMAIL;PREF;INTERNET:local@domain
END:VCARD

Here is the script ( honestly it is just a one line command but for more clarity.. ) :

这是脚本(老实说,它只是一个单行命令,但为了更清楚..):

#!/bin/bash

# This script convert a ThunderBird AddressBook ( 17.04) exported as CSV file using commas into a VCF 2.1 file.
# rmistero - April 2013 - GNU GPL 3


CSV_FILE="contacts.csv"
VCF_FILE="contacts.vcf"

# sed is looking for regex pattern NOT containing commas between 2 commas.

sed -e "s/^\([^,]*\|\".*\"\),\([^,]*\),\([^,]*\),[^,]*,\([^,\"\']*\),.*$/N:;\nFN:\nEMAIL;PREF;INTERNET:\n/g" -e "1d" < $CSV_FILE |  sed -e "/^EMAIL/ a\END:VCARD" -e "/^N/ i\BEGIN:VCARD\nVERSION:2.1" | grep -vE "^$|\"" > $VCF_FILE

Once the file has been converted, just put the file on the USB drive of your Android phone. Then go to Contact, Settings, and Import/Export a single vCard file.

文件转换完成后,只需将文件放在 Android 手机的 USB 驱动器上即可。然后转到联系人、设置和导入/导出单个 vCard 文件。

If everything goes well you should see the number of contact entries detected by the phone and the number loaded to the phone.

如果一切顺利,您应该会看到手机检测到的联系人条目数量以及加载到手机中的号码。

NOTE: to count the number of entries in contacts.csv, just do :

注意:要计算contacts.csv 中的条目数,只需执行以下操作:

grep -c EMAIL contacts.csv

This will return the number of lines matching "EMAIL" ( hence number of contacts).

这将返回匹配“EMAIL”的行数(因此是联系人数)。

回答by user3125766

An easy way to export all contacts in outlook as vcf is to select them all and choose email as attachments. Once the draft emails opens up with attachments, select all attachments, right click and copy. Got to a folder, right click and paste.

将 Outlook 中的所有联系人导出为 vcf 的一种简单方法是选择所有联系人并选择电子邮件作为附件。打开带有附件的电子邮件草稿后,选择所有附件,右键单击并复制。找到一个文件夹,右键单击并粘贴。

回答by Andrew

Okay so I'm on Android 7.0 but here's how I had to do it from my phone... I was importing from my old phone, a Windows Phone 8, and I think it could only export my contacts to CSV...

好的,所以我使用的是 Android 7.0,但这是我必须从手机上执行此操作的方法...我是从旧手机 Windows Phone 8 导入的,我认为它只能将我的联系人导出到 CSV...

(Fortunately that's a universal file extension (Comma Separated Values), and I was also able to remove some junk manually with regex - anyways...)

(幸运的是,这是一个通用文件扩展名(逗号分隔值),而且我还能够使用正则表达式手动删除一些垃圾 - 无论如何......)



Using either Firefox Beta or Google Chrome, I went to http://google.com/contacts, logged into the GMail account I wanted use for my phone's contacts, in Firefox Beta I had to tell it to use the old version of Contacts I think (the new version didn't have an import feature), and then the page looked like the standard web GMail layout kind of. On the left side was a link that said "Import Contacts...", so I clicked that, and then it let me choose a file from my phone ("Documents"); note that this part did not work in Firefox Focus.

使用 Firefox Beta 或 Google Chrome,我访问了http://google.com/contacts,登录了我想用于手机通讯录的 GMail 帐户,在 Firefox Beta 中,我不得不告诉它使用旧版本的通讯录我想想(新版本没有导入功能),然后页面看起来像标准的 Web GMail 布局。左侧是一个链接,上面写着“导入联系人...”,所以我点击了它,然后它让我从手机中选择一个文件(“文档”);请注意,这部分在 Firefox Focus 中不起作用。

At the top right I selected "Show internal storage", and then at the top left I opened up File Manager, selected my CSV file, and imported it into GMail Contacts. Then, it immediately synced all of the contacts over to my Android phone.

在右上角我选择了“显示内部存储”,然后在左上角我打开文件管理器,选择我的 CSV 文件,并将其导入 GMail 联系人。然后,它立即将所有联系人同步到我的 Android 手机。

回答by Jroling

MobiKin Assistant for Android can help you import or export contacts from android phone to excel format as CSV or XLS very easily. It is the popular tool of Android data backup and transfer. You can search "MobiKin Assistant for Android" by Google. Hope this helps!

适用于 Android 的 MobiKin 助手可以帮助您非常轻松地将联系人从 Android 手机导入或导出为 CSV 或 XLS excel 格式。它是Android数据备份和传输的流行工具。您可以通过 Google 搜索“Android 版 MobiKin 助手”。希望这可以帮助!