How to Alphabetize Tabs in Google Sheets

How-to basics · Updated November 3, 2026

How to Alphabetize Tabs in Google Sheets

Google Sheets does not have a built-in command to alphabetize sheet tabs. For a few tabs, drag them into order along the bottom of the spreadsheet; for many tabs, run a short Apps Script to sort the visible tabs by name. Before changing the order, make sure you have access to edit the spreadsheet and know that rearranging tabs does not sort the data inside them.

What You’ll Need

  • A Google account with edit access to the spreadsheet.
  • A web browser with the Google Sheets file open. The steps below are for Sheets in a browser.
  • For the automatic method, permission to open Apps Script and authorize a script for this spreadsheet. If you only have a few tabs, you can use the manual method instead.

Step-by-Step

  1. Choose manual or automatic sorting. Look at how many tabs you need to rearrange. If there are only a handful, dragging tabs is usually quickest and does not require authorizing anything. If there are many, or you expect to repeat the task, use the Apps Script method below. Google Sheets has no built-in Sort sheets alphabetically menu item, so a script is needed for automatic sorting.
  2. Check the current tab names. Find the sheet tabs along the bottom of the spreadsheet and review their names. Alphabetizing uses the names as they are currently written, so correct spelling, spacing, punctuation, or inconsistent prefixes first if you want a particular result. For example, a tab called “2025 Budget” may appear before tabs beginning with letters, depending on its characters and the ordering rules. Consistent names make the final order easier to scan.
  3. For a small workbook, move tabs by hand. Click and hold a sheet tab, drag it left or right along the tab bar, and release it when the small position indicator shows where it should go. Repeat for each tab until the names are in the order you want. Work from left to right: place the first name, then the second, then continue across the row. If the tabs do not all fit on screen, use the tab-navigation controls at the bottom to reach the remaining tabs, or widen the browser window.
  4. Open Apps Script for automatic sorting. For the script method, open the spreadsheet and select Extensions > Apps Script. This opens a script project associated with the spreadsheet in another browser tab. If Sheets asks whether to open the Apps Script editor, confirm. You do not need to create a separate spreadsheet or install an add-on.
  5. Add the sorting function. In the Apps Script editor, open the existing code file, commonly named Code.gs. Select and replace any sample code if the file contains only starter text, or paste the function below into a blank area. If the project already contains other functions, do not delete them; add this function after the existing code instead. The function sorts visible tabs without changing the contents of any sheet.
    function alphabetizeSheetTabs() {
      const spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
      const visibleSheets = spreadsheet.getSheets()
        .filter(sheet => !sheet.isSheetHidden());
    
      visibleSheets.sort((a, b) =>
        a.getName().localeCompare(b.getName(), undefined, { sensitivity: "base" })
      );
    
      visibleSheets.forEach((sheet, index) => {
        spreadsheet.setActiveSheet(sheet);
        spreadsheet.moveActiveSheet(index + 1);
      });
    }
  6. Save and run the function. Click the Save icon or press Ctrl+S on Windows or ChromeOS; on a Mac, use Command+S. In the function selector near the top of the editor, choose alphabetizeSheetTabs, then click Run. If the editor reports that the project has unsaved changes, save it and run again. The function moves visible tabs into ascending name order, ignoring letter case for comparisons.
  7. Authorize the script if prompted. On the first run, Google may ask you to choose an account and approve access for the script to manage the spreadsheet’s sheets. Review the permission prompt and proceed only if you opened the script from the spreadsheet you intend to organize and the code is the function shown here. A work or school account may block scripts through administrator policy; if so, ask the administrator or use the manual method.
  8. Return to the spreadsheet and verify the result. Switch back to the Sheets tab and check the visible tab names from left to right. The script sorts tab names, not rows, columns, or values within a sheet. Hidden sheets are not included: this function places visible sheets in alphabetical order and moves them ahead of hidden sheets. If you need hidden sheets included in the alphabetic sequence, unhide them first, run the function, then hide them again as needed.

Common Mistakes

Looking for a built-in sort command. The sheet-tab context menu and the Data menu do not provide a command to sort sheet tabs alphabetically. Data sorting applies to cells in a sheet, not to the order of tabs. Use drag-and-drop for a short list or the script above for a repeatable sort.

Sorting the data instead of the tabs. Choosing a sort option from the Data menu can rearrange rows in the active sheet. That will not change where the sheet appears in the tab bar. If your goal is to reorder sheets, do not select a cell range or use a data-sort command.

Expecting the script to sort hidden sheets too. The supplied function deliberately filters out hidden sheets. It places the visible tabs before hidden ones, so the tab bar may look different if your workbook relies on hidden tabs being interspersed. Unhide any sheets you want included before running the function, and check the workbook’s intended visibility afterward.

Overwriting other Apps Script code. Replacing all code in a file that already has useful functions can remove those functions. If you are unsure what the existing code does, do not erase it; paste the new function after the final closing brace of the existing code, save, and select the new function by name before running.

Assuming the order stays alphabetical automatically. The script runs once. If someone later renames a sheet, adds a new tab, or moves a tab manually, the list may no longer be alphabetized. Run the function again when needed.

Tips

Choose a naming convention before you sort. For example, use “April Sales,” “May Sales,” and “June Sales,” rather than mixing “Sales – April” with “May Sales.” A stable first word or prefix can make related tabs easier to locate. Remember that alphabetizing uses the full tab name, so a prefix such as “Archive -” groups all those tabs together rather than sorting them by the word after the dash.

Think about numbers in names. Ordinary alphabetical comparison is not the same as numeric ordering: names such as “Project 10” and “Project 2” may not appear in the numeric sequence you expect. If numeric order matters, use zero-padded names such as “Project 02” and “Project 10.” This also makes manual scanning and sorting more predictable.

Keep a clear distinction between rearranging tabs and changing sheet names. The script does not rename sheets, edit cell contents, or sort records. It changes only the position of the visible sheet tabs. Still, if a workbook is important or shared, tell collaborators before rearranging it, especially if they rely on a familiar tab position.

For a one-time change, manual dragging avoids script authorization. For a large workbook or a routine cleanup, keep the function in the spreadsheet’s Apps Script project so you can run it again. You can return to it later through Extensions > Apps Script. Do not run a script from a project you do not recognize, and review the code before approving permissions.

Troubleshooting

The tabs did not move when I dragged one. Make sure you are holding the tab itself, not a cell or the bottom scroll area. Pause briefly after clicking, drag toward the intended position, and release when the insertion marker appears. If the tab bar is crowded, scroll to the relevant section or widen the browser window and try again.

I cannot find the Apps Script editor. Confirm that you have edit access and that you opened the file in Google Sheets in a browser. The menu path is Extensions > Apps Script. If Extensions is unavailable or your organization disables Apps Script, use manual dragging or contact the file owner or administrator.

The script is not available in the Run menu. Check that the function name is spelled exactly alphabetizeSheetTabs, that the code has been saved, and that there are no syntax errors shown in the editor. Choose the function from the selector before clicking Run. If a red error appears, check that the code was pasted as shown and that braces and parentheses are present.

The script asks for access or shows an authorization error. The first run requires permission to manage sheets in the current spreadsheet. Confirm that the account shown is the one with access to the file, then follow the authorization flow. If a work or school administrator blocks the request, do not try to bypass the restriction; ask the administrator or use the manual approach.

The order looks unexpected. Review the exact tab names, including leading spaces, punctuation, and numbers. The code compares names without distinguishing uppercase from lowercase, but punctuation and numeric characters still affect ordering. Hidden sheets are moved behind visible sheets and are not sorted by this function. Adjust names or unhide sheets and run it again if that better matches your goal.

Frequently Asked Questions

Can Google Sheets alphabetize tabs automatically with one menu command?
No. Sheets has no built-in command for alphabetically sorting sheet tabs. Drag them manually, or use Apps Script to automate the rearrangement.

Does the script sort the rows inside each tab?
No. It changes only the positions of visible sheet tabs. It does not sort, edit, or move data inside any sheet.

Does it include hidden tabs?
No. The provided function alphabetizes visible tabs and places them before hidden ones. Unhide the tabs you want included, run the function, and then hide any that should remain hidden.

Will the tabs stay alphabetized after I add or rename a sheet?
No. The function runs only when you run it. Run it again after adding or renaming tabs if you want to restore alphabetical order.

Can I undo the script with Ctrl+Z?
Do not rely on Ctrl+Z to reverse an Apps Script change. If you want to restore the previous arrangement, drag the tabs back manually. For a workbook where the original sequence is important, note or record the order before running the function.

Can I alphabetize tabs on a phone or tablet?
You can usually move tabs in the Google Sheets mobile app, but the Apps Script editor workflow described here is intended for a desktop browser. For many tabs, open the spreadsheet in a browser on a computer and run the script there.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.