The Problem

Google Workspace administrators can create email aliases for a user so they can send and receive email from another address at your domain. As an administrator, sometimes, you need to find out users that have email aliases in their account information. Unfortunately, Google Admin interface is clunky for this task as email aliases are hidden in each user's profile page. That's mission impossible if you have hundreds of users in your directory.

Email aliases in Google Admin Console
Email aliases in Google Admin Console

The Solution

The following open source Google Apps Script can help you find out all users that have email aliases.


  1. Open
  2. Click New project.
  3. Name the script project in the title
  4. Copy and paste the following script to the script editor, overwriting existing function myFunction() {} code
  5. Click Services in the left navigation panel
    1. Select Admin SDK API
    2. Click Add
  6. Click Save Google Apps Script project button in the toolbar
  7. Click Run
  8. It will ask for your permissions in the first run
  9. After you grant the permission, the script shall run and print out the results in the Execution log.
    Execution log of printing users with email aliases 

Source code

 * list users that have email aliases
 * Usage:
 * 1. copy and paste this source code to your Apps Script Editor
 * 2. select the following function name
 * 3. click 'Run'.
 * 4. The users with email aliases will be printed in the 'Execution log'
 * © 2021 xFanatical, Inc.
 * @license MIT
 * @version 1.0.2 fix a pagination issue
 * @version 1.0.1 print out aliases
 * @version 1.0.0 proof of concept
function listUsersWithEmailAliases() {
  let pageToken
  let page
  do {
    page = AdminDirectory.Users.list({
      customer: 'my_customer',
      maxResults: 100,
      fields: 'users(name/fullName,primaryEmail,aliases),nextPageToken',
    let users = page.users
    if (users) {
      for (let i = 0; i < users.length; i++) {
        const user = users[i]
        if (user.aliases && user.aliases.length > 0) {
          Logger.log(`User ${} <${user.primaryEmail}> `
            + `has ${user.aliases.length} email alias${user.aliases.length > 1 ? 'es' : ''}: `
            + JSON.stringify(user.aliases))
    } else {
      Logger.log('No users found.')
    pageToken = page.nextPageToken
  } while (pageToken)

If you're interested in extending functions or automating your tasks as much as possible on Google Workspace, please check out our code-free workflow automation software Foresight. We also provide custom apps script development services to increase your productivity. Please don't hesitate to contact us. It's our passion and expertise to assist you on Google Workspace.