How to find the file upload dates for every spreadsheet in Google drive

Hi Community

Need help regarding google suite…there is a folder on the drive it has various spreadsheets. I want to upload every sheet in that folder to some other portal. But it has to be done in such a way that for example every day bot runs twice and if any new sheet has been added or not, if yes, it will pick that sheet and download it locally and upload it to the desired location.
Any help would be appreciated

1 Like

Hi

Did we try with this activity

Have a view on this video on how to perform upload and download from GSuite

Cheers @Aditya_Kumar3

1 Like

Thanks @Palaniyappan i am aware about this, what exactly i want is iterate through each Spreadsheet in a folder on Gdrive and download only those sheets which have been uploaded or modified lets say today or till yesterday. Any ideas how do i do that?

Hi @Aditya_Kumar3

Please find the below steps to achieve your functionality

  1. Use Google Drive Activity and configure your account
  2. Use Find Files and Folders Activity and under a search for objects section you can use your filter Ex: "fullText contains 'pdf'". This gets all the files which are of type PDF
  3. The result of step 2 would be an array of files
  4. Use for each activity to loop through all the files. The data type of the variable used in for each should be as below.
    image
  5. Then using that variable you can fetch multiple properties of that file. For example in your case
    item.CreatedTime and item.ModifiedTime . Based on these values you can set your filter and if that filter condition is satisfied, use the Download File activity.

Reference links:

hope this helps

Hi, i tried this but i cannot iterate through all the files in one specific folder in Drive. This gives me all the files in the drive. I want to access the files of a specific folder. Please help really in need here.

Hi @Aditya_Kumar3 Got your requirement. Here is the solution

First Find the ID of the drive where you to search files

  1. Use Google Drive Activity and configure your account
  2. Use Find Files and Folders Activity and under a search for objects section you can use your filter Output : arr_FolderNames
"name contains 'YOUR FOLDER NAME IN GOOGLE DRIVE'"  //This provides folder details
  1. If arr_FolderNames.count>0 Then step 4 else there is no folder in your google drive with the name you specified. please check that
  2. use Assign activity as below
str_FolderID = arr_FolderNames(0).Id    // This helps in finding folder id
  1. Use Find Files and Folders Activity and under a search for objects section you can use your filter Output: arr_FileNames
 "'"+str_FolderID+"'"+" in parents" .    // This provides all the files present in that folder. 
  1. If you would like to fetch only specific types of files from that folder you can use this query
"'"+str_FolderID+"'"+" in parents and fullText contains 'pdf'"  . // This fetches only PDF files in the folder specified 
  1. Then use for each loop through all files and you can fetch multiple properties of that file. For example in your case
item.CreatedTime and item.ModifiedTime

Based on these values you can set your filter and if that filter condition is satisfied, use the Download File activity.

Note:
If you would like to filter based on Modified date you can do it directly
Search for files modified after June 4th 2012

modifiedTime > '2012-06-04T12:00:00'    // default time zone is UTCmodifiedTime > '2012-06-04T12:00:00-08:00'
1 Like

Yes this works! Thankyou so much! Really appreciate it.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.