I'am using this script , but it takes all sheets of current spreadsheet. What I would like to achieve is that it would take sheets which name contains Ready.Any help would be appreciated.A bit modified script from original, but it doesn't achieve what I want:function importallMain() {  var id = 'some id';    var ss = SpreadsheetApp.openById(id); //Managed to exclude first 7 from array because adds (;)  var imports = ss.getSheets().splice(7).map(function(s) { if(['MasterBook', 'MasterClients', 'Rates', 'Listing', 'CreateDOC', 'Accounting' , 'Project'].indexOf(s.getName()) == -1) // Excluding by name    return 'importrange(' + id + ', ' + s.getName() + '!A11:Y500)';   });  var formula = '=query({' + imports.join('; ') + '},Select * where Col3 <> \'\' )';  SpreadsheetApp.getActiveSheet().getRange(A2).setFormula(formula);}
How to import only sheets with specific text in the name
google spreadsheets;google apps script;import
You can use string.match() of JavaScript to find the string ready in the name and only take those sheets. Like so:function importallMain() {  var id = 'some id';    var ss = SpreadsheetApp.openById(id); //Managed to exclude first 7 from array because adds (;)  var imports = ss.getSheets().splice(7).map(function(s) {   var sheetName = s.getName() if(sheetName.match(Ready) != null) // Excluding sheet that dont have ready in their name!     return 'importrange(' + id + ', ' + s.getName() + '!A11:Y500)';   });  var formula = '=query({' + imports.join('; ') + '},Select * where Col3 <> \'\' )';  SpreadsheetApp.getActiveSheet().getRange(A2).setFormula(formula);}