What is the variable to select in a Google Drive folder the file with the oldest modification or creation date?
Welcome to the Make community!
Yes, that is possible. You’ll need a minimum of one module:
This is just an example. Your final solution may or may not look like this depending on your requirements.
To sort by oldest modified time instead, change the orderBy
to modifiedTime
.
For more information, see Method: files.list | Google Drive | Google for Developers
Module Export - quick import into your scenario
You can copy and paste this module export into your scenario. This will import the modules (with fields/settings/filters) shown in my screenshots above.
-
Move your mouse over the line of code below. Copy the JSON by clicking the copy button on the right of the code, which looks like this:
-
Enter your scenario editor. Press ESC to close any dialogs. Press CTRLV (paste keyboard shortcut for Windows) to paste directly in the editor.
-
Click on each imported module and re-save it for validation. There may be some errors prompting you to remap some variables and connections.
JSON module export — paste this directly in your scenario
{"subflows":[{"flow":[{"id":206,"module":"google-drive:makeApiCall","version":4,"parameters":{"__IMTCONN__":94797},"mapper":{"url":"/v3/files","method":"GET","headers":[{"key":"Content-Type","value":"application/json"}],"qs":[{"key":"q","value":"mimeType != 'application/vnd.google-apps.folder' and 'FOLDER_ID_GOES_HERE' in parents"},{"key":"orderBy","value":"createdTime"},{"key":"pageSize","value":"1"}]},"metadata":{"designer":{"x":2707,"y":-667,"name":"Get oldest created file in folder"},"parameters":[{"name":"__IMTCONN__","type":"account:google-restricted","label":"Connection","required":true}]}}]}],"metadata":{"version":1}}
Note: Did you know you can reduce the size of blueprints and module export code like the above, using the Make Blueprint Scrubber?
Hope this helps! Let me know if there are any further questions or issues.
— @samliew
P.S.: Did you know, the concepts of about 70% of questions asked on this forum are already covered in the Make Academy. Investing some effort into it will save you lots of time and frustration using Make later!
Thanks !!! i try this
I have one more question. I have a Googlesheet table with rows sorted by date (dd/mm) with the name and email of a customer opposite. I would like to be able to trigger the sending of an email on Sunday to all customers whose date is between Monday and Sunday of the current week. thanks in advance. I think you should use a date format but I don’t know how to configure it
blueprint (1).json (61.6 KB)
No problem, glad I could help!
1. If anyone has a new question in the future, please start a new thread. This makes it easier for others with the same problem to search for the answers to specific questions, and you are more likely to receive help since newer questions are monitored closely.
2. The Make Community guidelines encourages users to try to mark helpful replies as solutions to help keep the Community organized.
This marks the topic as solved, so that:
- others can save time when catching up with the latest activity here, and
- allows others to quickly jump to the solution if they come across the same problem
To do this, simply click the checkbox at the bottom of the post that answers your question:
3. Don’t forget to like and bookmark this topic so you can get back to it easily in future!
Hope this helps! Let me know if there are any further questions or issues.
— @samliew
P.S.: Did you know, the concepts of about 70% of questions asked on this forum are already covered in the Make Academy. Investing some effort into it will save you lots of time and frustration using Make later!