I asked a similar question a while ago that involved moving tabs of a certain color to the end of my tabs. That question with it's answer is HERE
Now, I need to remove all of those tabs from my ever-growing workbook. I have another workbook for dead deals, but it's going to take too long to move each tab manually. Is there a similar function to the one in the answer above that will move all of the tabs of the certain color into a completely different workbook, or am I stuck doing it manually?
Here is the code I've got:
function moveSheetsOfAColorToEnd(color) {
var color=color || '#ff0000';
if(color) {
var ss=SpreadsheetApp.getActive();
var shts=ss.getSheets();
for(var i=0;i<shts.length;i++) {
if(shts[i].getTabColor()==color) {
Sheets.Spreadsheets.batchUpdate(
{
requests:[
{
"updateSheetProperties":
{
"properties":
{
"sheetId":shts[i].getSheetId(),
"index": shts.length
},
"fields": "index"
}
}
]
}, ss.getId());
}
}
}
}
I really don't understand javascript (if this is javascript) enough to understand what's what. I'm guessing the bit inside Sheets.Spreadsheets.batchUpdate{}
needs to be changed, but I don't know what to change it to.