The log spits out the information that I want (a timestamp of when the file was last updated), but when trying to setValues() in the adjacent column, I get "Exception: The parameters ((class)) don't match the method signature for SpreadsheetApp.Range.setValues."
More specifically...
var sheetID is a list of spreadsheet IDs from various sources
var pasteRange is the array in which I want to paste in the date/time that the sheet was last updated.
function getLastModified() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var getTab = ss.getSheetByName("Tab1");
var sheetID = getTab.getRange("L2:L101").getValues();
var pasteRange = getTab.getRange("K2:K101");
for (i=0;i<sheetID.length;i++){
if(sheetID[i] == ""){
} else {
var file = DriveApp.getFileById(sheetID[i]);
var date = file.getLastUpdated();
//
pasteRange.setValues(date);
//the log works
Logger.log(date)
}
}
}
setValues()requires a 2D array and you are passing one value. You can try this code that loops through all rows, accumulates values indatesarray and then records all of them at once. As a benefit, it will be much faster.