Find file/folder action in Google Drive

The Find file/folder action enables you to find files or folders in a specific directory in your Google Drive.

Settings

  • Enter the same username that you provided in the Connect action.
  • Choose one of the following options:
    • To find a file or files, click File.
    • To find a folder or folders, click Folder.
  • After selecting either File or Folder, you can specify the source folder path or the source folder ID.
    • Source folder path: Specify the folder where the file or folder you are trying to find is located. For example, if the file or folder you are trying to find is within a folder called Home/Accounts in Google Drive, enter Home/Accounts as the source folder path. If it is within a folder called Home, enter just Home without any forward slash. If the file or folder is in the root directory (My Drive), enter root as the source folder path.
    • Source folder id: Enter the ID of the folder where the file or folder you are trying to find is located. If there are multiple folders with the same name, using the folder ID can help you search for files or folders in a specific folder.
  • From Match type, you can choose one of the following options:
    • If you want the API to return results that exactly match the specified file or folder name, select Exactly matches.
    • If you want the API to return results that partially match the specified file or folder name, select Contains.
  • In File/Folder name, specify the name of the file or folder you want to locate. If the file has a file extension in Google Drive, make sure to include the file extension as well.
  • The Find file/folder API returns a dictionary with information about matched files. The dictionary contains a key called NumberOfFiles. It provides the count of files that matched. The dictionary also contains keys named File1, File2, and so on, depending on the number of matched files. These keys contain information such as file names and file IDs in JSON format. The following is an example of a dictionary returned by the Find file/folder API call:
    {NumberOfFiles,1},{File1,{"fileName":"contacts","fileId":"171yBUzqH80ZW_KLEp23DwebzkCdDZgnGFWBzB6K9kco"}}
    You can use one of the following options to retrieve the results:
    • Multiple variables: Use this option if you want to map each key to a variable.
    • Dictionary: You can also create a dictionary variable with the subtype as Any and store the dictionary returned by the API to the variable. You can then retrieve information, such as file names, file IDs, folder names, and folder IDs, by parsing the JSON string. For more information, see Example of using Find file/folder action from Google Drive package