If you are in a Google Workspace environment, you have likely encountered this frustration: your company has a directory of hundreds of employees, but when a colleague calls your cell phone, you don’t see their name - only a raw phone number.

The Problem

Google Workspace keeps the Domain Directory (the global list of employees) separate from your personal contacts.

While you can search for a colleague in Gmail, their details do not automatically sync to your mobile device’s address book. This leads to two common annoyances:

  • No Caller ID: You don’t know which colleague is calling you.

  • Stale Data: You can manually export/import a CSV file, but the moment a new employee is hired or someone changes their number, your phone is outdated.

The Solution: Google Apps Script

Instead of manually managing CSV files, we can use Google Apps Script to bridge the gap. We can write a script that fetches the company directory, checks against your existing contacts to prevent duplicates, and pushes new employees to your account automatically.

Here is how to set it up.

Step 1: Create the Script

  1. Go to script.google.com.

  2. Click New Project.

  3. Name the project something like “Directory Sync”.

Step 2: Enable the APIs

This script requires access to two specific Google services. You must enable them manually in the editor:

  1. On the left sidebar, click the Editor (code icon).

  2. Find Services on the far left and click the + (plus) button.

  3. Add Admin SDK API (allows reading the company directory).

  4. Add People API (allows writing to your contacts).

Note: When adding the People API, ensure the “Identifier” is set to People.

Step 3: The Code

Copy and paste the following code into your Code.gs file.

Step 4: Automate It

To ensure you always have the latest new hires on your phone, set the script to run automatically.

  1. Click on the Triggers icon (alarm clock) in the left sidebar.

  2. Click + Add Trigger.

  3. Set the function to syncDirectoryToConnections.

  4. Set the event source to Time-driven.

  5. Set the timer to Day timer (e.g., Midnight to 1 am).

Now, your personal contacts will silently update every night, ensuring your Caller ID is always accurate.

Disclaimer: Parts of this article are written using llms