Fetch files inside a Google drive folder using a folder Id

Hi,

I have a requirement where I have to fetch all the file ids inside google drive folder. I have a folder id as input. Please let me know your thoughts.

Note: We are using service account for Gsuite authentication.
Thanks in advance!

1 Like

Hi

Welcome back to UiPath forum

Have a view on this video and it has a demo on how to print file ids

Cheers @Newton_Rich_SV

Hi @Newton_Rich_SV ,

  1. Drag and drop “Google G Suite” application scope activity from the “Activities” panel.
  2. In the “Properties” pane, configure the “Application Scope” by specifying the “Account” property with the account credentials for your Google Drive account.
  3. Drag and drop “Drive Files” activity inside the application scope activity.
  4. In the “Properties” pane of the “Drive Files” activity, configure the “Query” parameter with 'your-folder-id' in parents and trashed = false (replace ‘your-folder-id’ with the actual ID of the folder you want to fetch files from).
  5. In the “Fields” parameter of the “Drive Files” activity, select the fields you want to retrieve, such as “ID” or “Name”.
  6. Drag and drop a “For Each” activity below the “Drive Files” activity.
  7. In the “Properties” pane of the “For Each” activity, set the “TypeArgument” property to “Google.Apis.Drive.v3.Data.File”.
  8. In the “Values” property of the “For Each” activity, set it to DriveFilesResult.Files.
  9. Add an “Assign” activity inside the “For Each” activity.
  10. In the “Properties” pane of the “Assign” activity, set the “To” property to a variable that will hold the file ID, and set the “Value” property to item.Id.

Thanks

@Newton_Rich_SV

Try below steps

Use Find Files activities and pass your Id as below

“'”+ VariableofYourFolderID +“’ in parents”

Declare a variable for Result

Now use For Each activity and pass the Result variable

Also For Each TypeArgument Property set as Google.Apis.Drive.v3.Data.File

Inside for each you can use Item.Id to get all the ID’s inside the Folder ID you have given

Hope this may help you

Thanks,
Srini

1 Like