Search or create a folder Google Drive

Hey guys,

I am trying to create a workflow where we look for a client’s folder in Google Drive, and if the folder doesn’t exist, the automation will create one.

I can’t figure out what module should I use here.

Thanks in advance for your help!!

You can follow these steps
Use the “Google Drive > List Files and Folders” module: This module allows you to search for the client’s folder in Google Drive by specifying the search parameters such as the folder name or any other identifying information.

Add a “Filter” module: Connect the output of the “List Files and Folders” module to a “Filter” module. Set up the filter to check if the client’s folder exists in the search results. If the folder is found, the workflow can proceed without creating a new one. If the folder is not found, the workflow will continue to the next step.

Use the “Google Drive > Create Folder” module: Connect the output of the “Filter” module to the “Create Folder” module. Set the desired folder name and specify the location where you want the new folder to be created. This module will create the client’s folder in Google Drive.

Depending on your workflow requirements, you can add further actions such as sending notifications, updating records, or performing other tasks related to the newly created or existing client’s folder.
By combining the “List Files and Folders,” “Filter,” and “Create Folder” modules in this way, you can create a workflow that checks for the existence of a client’s folder in Google Drive and creates one if it is not found.
More Support…
Best Regards
Pro_Tanvee

1 Like

Awesome thanks!!

This resolves one of the issues I was having, however, I am unsure it will be a final solution, this is why:

If the client’s folder exists, we must proceed to create the rest of the folders INSIDE the existing client folder.

If the client’s folder doesn’t exist, we will create the folder + the rest of the folders inside that one.

Should I use a filter module with two strings of actions depending on whether the folder exists or not?

I am not very sure how to go about it, I hope I explained this properly

Hi @Carlos_Adell,

Yeah, What you can do is, Add a filter After Search for Files/Folders Module, Add a router,

  1. First path of the router will check if File ID Exists, Then Proceed with Create Folder/File, With Root Folder Being the File ID that you get from Search Modules

  1. On the Second, Route, Just Do if the FIle ID Doesn’t exist, Then create Client Folder, and over there choose Root Folder Location as the one that you want to put a new client folder on. After that, Just resume with Other Folder Creation



If the Number of Folder/File that you want to create inside Client Folder is numerous then the above approach will result in duplicate paths, So, What you can do is set up your scenario as,

  1. Add a router after search
  2. First Path will be if Client Folder doesn’t; exist > Create a New Folder > Set Variable
  3. Second Path will not have any filters, and after which do Get a Variable > Then Create a New Folder for Clients

Check this blueprint for more,

blueprint (42).json (13.8 KB)

1 Like

Thank you very much!!

I think I resolved following your advice, see the screenshot below. However, I am not sure I understand your last suggestion where you mention:

"If the Number of Folder/File that you want to create inside Client Folder is numerous then the above approach will result in duplicate paths, So, What you can do is set up your scenario as,

Add a router after search
First Path will be if Client Folder doesn’t; exist > Create a New Folder > Set Variable
Second Path will not have any filters, and after which do Get a Variable > Then Create a New Folder for Clients"

Hi @Carlos_Adell,

Good to know you actually completed the scenario. The second approach I mentioned is really useful as it will allow you to add a single flow of logic to create sub-folders files.

As from your screenshot, For eg, If you need to update a logic/name of any one of the folders, you need to do it twice in the first path and in the second path. if that is not a big hassle and that is something that doesn’t require frequent modification you can just keep the scenario as it is.

1 Like

Thank you my man!! I am not sure this is the problem I am having now, but I just created another scenario, using the same logic, to create more folders inside the client’s folder.

Now the scenario looks for the folder, and the folder with the clients name already exists, but the scenario stops right there and gives me the error you can see on the screenshot, any idea what this may be??

Since you copied that, I think the webhook that you currently have different value or name for the client details that you want to search in Google Drive.

Just review the mapping of second module for the search term that you are using, map it with the data that you get from webhook and that should fix the issue.

Thanks @Runcorn , but I don’t think this is the case, please check the video here, see if there is anything I am doing wrong: