3 Best Ways to Alphabetize in Google Docs

Alphabetize in Google Docs

It is currently not possible to alphabetize in Google Docs. If you want to alphabetize a list in Google Docs. If you want to organize text in Google Docs alphabetically, you can’t. You will need the help of a spreadsheet to alphabetize data in Google Workspace.

This feature is only available in Google Sheets. However, to make alphabetizing available, there are some workarounds I found.

There is no easy way that is shipped with Google Docs itself this isn’t Google Sheets where you can sort from A to Z or Z to A.

But there are some workarounds you can use if you have a Google account.

Alphabetize in Google Docs

To alphabetize in Google Sheets, so long lists are in ascending or descending order, you have three options:

  1. Copy/paste your text from Google Docs to Google Sheets. Use Data, Sort Sheet A to Z or Z to A. Paste the data back into Google Docs.
  2. Use an Extension in Google Docs by going to Extension, Add-Ons, Get Add-Ons, Search App “Sorted Paragraphs” and install it.
  3. Create your own Google Docs Extension.
Alphabetize in Google Docs
Alphabetize in Google Docs

Installing an add-on or using Sheets helps to format a row of text in alphabetical order in Google docs.

Read more about Alphabetizing in Google Sheets.

Order Lists in Google Docs Video Tutorial YouTube

1. Use Google Sheets

Mark the text you want to sort. Copy it by using control-c (cmd-c on a Mac).

Usorted list in Google Docs
Unsorted list in Google Docs

Go into Google Sheets. Paste the text by using control-v (cmd-V on a Mac).

Copy List into Google Sheets and Sort sheet from A to Z or from Z to A
Copy List into Google Sheets and Sort the Sheet from A to Z or from Z to A

Go onto data and then “Sort Sheet.” Choose “Sort Sheet” by column A (A to Z) or (Z to A).

Copy the sorted list in Sheets. Go back to Google Docs. Paste the list.

Paste Ordered Copy of Google Sheets back into Google Docs
Paste Ordered Copy of Google Sheets back into Google Docs

Now you have an alphabetized list on Google Docs.

Ordered list pasted from Google Sheets
Ordered list pasted from Google Sheets

2. Install an Extension

You can also install an extension. An extension extends the functionality of Google Docs.

There is an extension called “Sorted Paragraphs.”

To install this extension go to “Extensions,” “Add-Ons,” and “Get add-ons.”

Go onto Extensions Add-ons and then Get add-ons
Go onto Extensions Add-ons and then Get add-ons

Then search for “Sorted Paragraphs.”

Find Sorted Paragraphs Extension and install it
Find Sorted Paragraphs Extension and install it

Install it and then close Google Docs and reopen it.

Now under “Extensions,” you will find “Sorted Paragraphs” and the options “Sort A to Z” and “Sort Z to A.”

Use Extension Sorted Paragraphs to Sort List
Use Extension Sorted Paragraphs to Sort List

Mark the text and then click on any of these two options. The list adjusts and will be in alphabetical order.

Alphabetized List in Google Docs
Alphabetized List in Google Docs

3. Create your Own Extension

You can also create your own extension using App Script. Under “Extensions,” open “App Scripts.” Add your code. Give the project a name. Save it. Then deploy it as a test deployment. Create an Editor Add-on. Add it to a specific document. Run it.

Here is the code I created to Alphabetize in Google Docs. You can use it as is or develop it further.

My App Script Code to Alphabetize in Google Docs:

function alphabetize() {

  var doc = DocumentApp.getActiveDocument();

  var selection = doc.getSelection();

  if (selection) {

    var selectedText = selection.getRangeElements()

                                .map(function(el) {

                                    return el.getElement().getText();

                                });

    selectedText.sort(function(a, b) {

                                    return a.localeCompare(b);

                                });

    var elements = selection.getRangeElements();

    for (var i = 0; i < elements.length; i++) {

      var element = elements[i].getElement();

      element.setText(selectedText[i]);

    }

  } else {

    DocumentApp.getUi().alert("Please select the list you want to sort");

  }

}

function onOpen() {

  var ui = DocumentApp.getUi();

  ui.createMenu('Custom Scripts')

      .addItem('Alphabetize', 'alphabetize')

      .addToUi();

}

To alphabetize text, you need the help of Google docs and Google Sheets to create a list alphabetically.