A KaPaPi tool for Google Docs
SortDoc
SortDoc is a Google Docs add-on that sorts the paragraphs or list items you have selected, A to Z or Z to A, without flattening their formatting.
Banana Apple Cherry
Apple Banana Cherry
Select the lines you want in order, then choose Extensions → SortDoc → Sort A → Z. That is the whole product.
Formatting moves with the line
Most sorting tools read your lines out as plain text, sort the strings and type them back, which is why bold, links, headings and bullets tend to disappear. SortDoc reorders the document elements instead, so each line carries its own formatting with it.
Sort rules
| Rule | Behaviour |
|---|---|
| Case | Ignored when comparing (banana and Banana are equal) |
| Leading/trailing whitespace | Ignored when comparing; never removed from the document |
| Comparison | localeCompare, so accented and non-Latin text orders sensibly |
| Equal values | Keep their original relative order, in both directions (stable) |
| Empty paragraphs | Sort first A→Z, last Z→A |
| Numbers | Compared as text, so 10 sorts before 9 |
If SortDoc cannot sort a selection safely, it changes nothing and says so. Refusing is always preferred over risking the document.
Permissions
| Permission | Why |
|---|---|
documents.currentonly | Read and edit only the document it is open in. Not Drive, not your other documents |
script.container.ui | Draw its menu and messages inside Google Docs |
SortDoc makes no network requests. Nothing about your document is sent anywhere, stored anywhere, or logged. Full detail in the privacy policy.
Good to know
- Sorting is whole-block: it reorders the paragraphs you selected, it does not reorder words inside a paragraph.
- The selection must be a run of consecutive paragraphs or list items in the same part of the document. Anything else is refused rather than guessed at.
- Editor add-ons run on desktop only; Google does not support them in the Docs mobile apps.
SortDoc is free. The source is public at github.com/kapapi-dev/sortdoc.