title: Move every tab of a certain color to a separate workbook
body: <p>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 <a href="https://stackoverflow.com/questions/55615113/is-there-a-code-for-google-sheets-that-will-move-every-tab-of-a-specific-color-t">HERE</a></p>
  
  <p>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?</p>
  
  <p>Here is the code I've got:</p>
  
  <pre class="lang-js prettyprint-override"><code>function moveSheetsOfAColorToEnd(color) {
    var color=color || '#ff0000';
    if(color) {
      var ss=SpreadsheetApp.getActive();
      var shts=ss.getSheets();
      for(var i=0;i&lt;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());
        }
      }
    }
  }
  </code></pre>
  
  <p>I really don't understand javascript (if this is javascript) enough to understand what's what. I'm guessing the bit inside <code>Sheets.Spreadsheets.batchUpdate{}</code> needs to be changed, but I don't know what to change it to.</p>