How to sort the sheets in a spreadsheet alphabetically AND exclude a sheet from the sort
Notes
You can exclude additional sheets by increasing the .splice() number and the index in the for () loop
Spreadsheet (Make a copy from the File menu)
https://docs.google.com/spreadsheets/...
Script (Replace less_than_sign and greater_than_sign appropriately)
function sortSheets() {
const sh = SpreadsheetApp.getActive();
let sheets = sh.getSheets();
sheets = sheets.map(ss =greater_than_sign ss.getName());
sheets.sort();
for (let i = 0; i less_than_sign sheets.length; i++){
sh.setActiveSheet(sh.getSheetByName(sheets[i]));
sh.moveActiveSheet(i+1);
}
}
function sortSheetsExclusive(){
const sh = SpreadsheetApp.getActive();
let sheets = sh.getSheets();
sheets = sheets.map(ss =greater_than_sign ss.getName());
sheets.splice(0,1);
sheets.sort();
for (let i = 0; i less_than_sign sheets.length; i++){
sh.setActiveSheet(sh.getSheetByName(sheets[i]));
sh.moveActiveSheet(i+2);
}
}
Connect with me:
• spencer.farris@gmail.com
• spencerfarris.me
• www.linkedin.com/in/spencer-farris/
• Twitter @FarrisSpencer
• Google Product Expert support.google.com/docs/profile/12305
Donate on Paypal: spencer.farris@gmail.com
In questa pagina del sito puoi guardare il video online Sort Sheets della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Spencer Farris 23 gennaio 2024, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 1,997 volte e gli è piaciuto 13 spettatori. Buona visione!