Хорошо, я нашел решение. В моем случае файлы, которые мне нужно изменить, помещаются в разные папки и имеют похожее имя
// function that i need to execute
function updatePrices(sheetId){
// do some staff
var activeSpreadsheet = SpreadsheetApp.openById(sheetId);
var histPricesSheet = activeSpreadsheet.getSheetByName(someSheetName);
....
var cell = histPricesSheet.getRange(range);
cell.setValues(someData);
}
function walkFolders(folderId){
// function that walk by folders and get ids of spradsheeds
and call func that I need in each spradsheed that I need
var fin_fold = DriveApp.getFolderById(folderId);
var folders = fin_fold.getFolders();
while (folders.hasNext()) {
var folder = folders.next();
var files = folder.searchFiles('title contains "карточка"');
while (files.hasNext()){
var file = files.next();
updatePrices(file.getId()); // call my function to every spreadsheet
Logger.log("обновлено");
}
}
}
walkFolders("folder ID wich contain folders with files to change");