Since you have all the data conveniently stored in a Google Sheet, the most efficient way to automate tasks is by using Google Apps Script. Below is an example of how you can make this process work seamlessly.
Give this code a try:
function myFunction() {
var ss = SpreadsheetApp.getActive().getSheetByName("Sheet20"); // Modify this to match your sheet name
var range = ss.getDataRange();
var values = range.getValues();
for(var i=1; i<values.length; i++)
{
values[i][1] = lastModifiedTime(values[i][0]); // 0 represents the column where IDs are stored
// 1 represents the column where time will be displayed.
}
range.setValues(values);
}
function lastModifiedTime(id)
{
var file = DriveApp.getFileById(id);
return file.getLastUpdated();
}
Data input:
Replace the Sheet ID fields with the appropriate IDs.
https://i.sstatic.net/kQKMb.png
Outcome:
https://i.sstatic.net/PSV5y.png
Make sure to adjust the format of the column where you want the last modified time to be displayed as Number > Date time
.
To automate this script, set up a time-driven trigger within Google Apps Script to run the script at specified intervals (e.g., every 5 or 10 minutes) for accurate and updated results.
Trigger setup:
https://i.sstatic.net/aG2s0.png
Helpful resources: