You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Google Workspace中能否将Google通讯录联系人插入Google Docs?

解决方案

方法1:Google Sheets + Docs 邮件合并(无代码方案)

  • 导出Gmail联系人到表格
    打开Google联系人(Gmail左侧菜单可直接进入),选中目标联系人后点击顶部「导出」,选择导出格式为Google Sheets。导出后的表格会自动保存到你的Drive,包含联系人的街道、邮编等所有字段。
  • 制作Docs信函模板
    打开你的信函文档,在需要插入地址的位置预留占位(比如写[街道地址]、[邮编]),或者直接写好固定内容,只留变量位置。
  • 执行邮件合并
    在Docs顶部菜单点「扩展」,搜索并启用邮件合并插件(比如官方的「Mail Merge for Google Docs」)。选择导出的联系人表格作为数据源,将Docs里的占位符和表格对应字段(如“街道”“邮编”)做映射,完成后即可批量生成带对应地址的信函,也可单条插入指定联系人信息。

方法2:Google Apps Script 自定义插入(高灵活性)

如果需要更定制化的操作,比如直接在Docs里搜索联系人并插入地址,可使用以下脚本:

  1. 打开目标Docs文档,点击「扩展」→「Apps Script」
  2. 替换默认代码为:
function insertContactAddress() {
  const contactIdentifier = Browser.inputBox('输入联系人姓名或邮箱');
  if (!contactIdentifier) return;

  const contacts = ContactsApp.getContacts();
  let targetContact = null;
  for (const contact of contacts) {
    if (contact.getFullName() === contactIdentifier || 
        contact.getEmails()[0]?.getAddress() === contactIdentifier) {
      targetContact = contact;
      break;
    }
  }

  if (!targetContact) {
    Browser.msgBox('未找到对应联系人');
    return;
  }

  const addresses = targetContact.getAddresses();
  if (addresses.length === 0) {
    Browser.msgBox('该联系人无地址信息');
    return;
  }
  const address = addresses[0];
  const addressText = `${address.getStreet()}\n${address.getCity()} ${address.getPostalCode()}`;

  const cursor = DocumentApp.getActiveDocument().getCursor();
  cursor ? cursor.insertText(addressText) : Browser.msgBox('请先定位光标到插入位置');
}
  1. 保存脚本并完成授权(首次运行需按提示允许权限)
  2. 返回Docs,通过「扩展」→「Apps Script」运行insertContactAddress函数,输入联系人信息后,地址会自动插入到光标位置。

注意事项

  • 导出联系人时确认勾选所有需要的字段,避免表格缺失数据。
  • 邮件合并时需确保占位符与表格字段准确映射,防止替换失败。
  • 企业账号使用Apps Script可能需要管理员授权。

内容的提问来源于stack exchange,提问作者kicaj

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.19 17:39:56