Get list of folders in Gmail

Is it possible, either with Gmail Integration, IMAP or invoke code, to fetch a list of all the email folders from Gmail? I know it’s possible, because the For Each activity within “Use Gmail” actually presents a dropdown list of all the folders to the developer. So if I want to capture that list and present it to the user, how would I do that?

Hi @Terry_Marr ,

Yes it is possible. Follow the below steps :

  1. Use Gmail activity to connect to Gmail.
  2. Use For Each activity to iterate over the list of folders.
  3. Inside the loop, capture the name of each folder and add it to a list or array variable.
  4. After the loop, present the list of folder names to the user using UiPath activities.

also here is a link for official documentation on how to configure the ‘Use Gmail’ Activity

Hope this helps out. Please mark as solution if it does and if you have any trouble let me know.

Happy automating.!



Gmail Integration: UiPath provides Gmail activities that you can use to interact with Gmail directly. You can use the “Get Labels” activity to retrieve a list of all email folders (labels) from Gmail. Here are the steps:

a. Install the “UiPath.GSuite.Activities” package from the UiPath Marketplace if you haven’t already.

b. Drag and drop the “Get Labels” activity onto your workflow.

c. Configure the activity with your Gmail account credentials.

d. Run the workflow. The activity will fetch a list of all email folders from Gmail.

IMAP: UiPath also supports IMAP integration, allowing you to connect to Gmail’s IMAP server and fetch the list of email folders. Here’s how:

a. Use the “Connect IMAP” activity to establish a connection to Gmail’s IMAP server.

b. Use the “Get Folder List” activity to retrieve a list of all email folders.

c. Configure the activities with your Gmail account credentials and server settings.

d. Run the workflow. The activities will fetch the list of email folders from Gmail.

GSuite – There is no listed “Get Labels” activity

IMAP – there is no listed “Get Folder List” activity

Even in Google → Workspace → Gmail – there is nothing like that to fetch list of folders

In your step 2 - you say “iterate over the list of folders”. Yes, but how to get that list? What do I call to get the list of folders?

Hi @Terry_Marr ,

Please check this activity out.

For getting the list of files or folders from Google drive.