Reordering tags

TalkWelcome to LibraryThing!

Join LibraryThing to post.

Reordering tags

1DebiCates
Dec 14, 2025, 10:02 pm

Is there a function to alphabetize one's tags, across the board? Or to at least display them in alphabetical order when I look at a book in "Your books"?

P.S. I know I can see a list of tags is alphabetized. It's per book that I mean.

2bnielsen
Dec 15, 2025, 3:14 am

Nope. That feature disappeared years ago. (2012?)

See https://www.librarything.com/topic/367700

3DebiCates
Edited: Dec 15, 2025, 7:27 am

>2 bnielsen: Thank you for the link, Kai.

Bummer.

Am I correct that the LT export doesn't work as an import back into itself? Otherwise, I could export, fix tags to alphabetized using Excel, then import it back.

4Bookmarque
Dec 15, 2025, 7:33 am

Right. The loop there is broken and according to Tim's last post about it (I'd have to search and I'm too lazy), there is a major technical reason why it won't be closed. People keep asking though.

5bnielsen
Dec 15, 2025, 8:19 am

>3 DebiCates: Yes, bummer. You can export, have a script tell you which tags are not alphabetized, and then fix it by hand.

Rinse, wash, repeat :-)

6DebiCates
Dec 15, 2025, 8:31 am

>4 Bookmarque: Thanks Kris. I'm a computer programmer and am interested in understanding the loop that can't be closed. I'll see if I can find that post.

7Bookmarque
Dec 15, 2025, 8:35 am

>6 DebiCates: It will be in the RSI group probably.

8DebiCates
Dec 15, 2025, 8:40 am

>5 bnielsen: None of my sets of tags are alphabetized. Fixing by hand would kill my reading ambitions for 2026.

However, the export might solve the problem. That is, to identify books that are missing various classifying tags I want to have set on every book. I think most do have all, so it's just a matter of finding those that don't. Not a tiny project, but doable...maybe.

9DebiCates
Dec 15, 2025, 8:43 am

>7 Bookmarque: I think I found it https://www.librarything.com/topic/219575

Will get back to that and read later. Thanks Kris!

10Bookmarque
Dec 15, 2025, 8:48 am

It's message 162.

11norabelle414
Dec 15, 2025, 8:55 am

It's terribly frustrating, especially knowing that this used to be a feature and it was removed and never came back. I alphabetize my tags by hand, when I have the time, and it does take forever.

12DebiCates
Dec 15, 2025, 9:02 am

>10 Bookmarque: Do you know if it has ever been discussed or considered to allow us to export certain fields of our data, tweak it, and import that field back in as an update to existing data? (It would, of course, need the unique identifying key also as part of the export/import to work.)

13DebiCates
Dec 15, 2025, 9:04 am

>11 norabelle414: I hear you. I won't even attempt it, it's too daunting. My tags came from GR and although there I see them alphabetically, obviously they are not stored that way within GR because they came over in a complete jumble.

14Bookmarque
Dec 15, 2025, 9:05 am

>12 DebiCates: Probably. The subject comes up a few times a year. All in the RSI group I think. Going down this rabbit hole might eat into your productive reading though. LOL.

15DebiCates
Edited: Dec 15, 2025, 9:07 am

>14 Bookmarque: LOL. To read or to catalogue, that is the question.

16bnielsen
Dec 15, 2025, 11:29 am

>15 DebiCates: Depending on your tags and programming skills it might be doable to alphabetize the tags rather easy. If the correctly alphabetized version of the tags are fairly common (my example would be something like "Comics, Fiction, Humour") you could create a search string to find either a batch of them or all of them in LT and then copy paste into a view in Your books. Either just a "click to edit", "paste", "click to save" pr book or doing something with Power Edit to save even more clicks.

That's sort of how I entered List Price for about 3000 of my books.

17DebiCates
Edited: Dec 15, 2025, 12:13 pm

>16 bnielsen: That's an idea...I'll give that a ponder. I have so many tag schemes going that will likely not match much in batches. Too many permutations, I think.

In addition, I may need to rethink my GR-centric schemes and make them LT ones. Maybe lean into using some of the other fields available in LT that were not available (or sometimes unreliable) in GR.

Which do I enjoy more: reading or playing around with data? It can be a close call.

18bnielsen
Dec 15, 2025, 1:33 pm

>17 DebiCates: I think it is a 5 minute hack to get the tags for each book, split on ", ", sort, join with ", " and see how many of each you have.
And if all tag combinations are unique, you don't need to remember authors and titles :-)

19DebiCates
Dec 15, 2025, 2:00 pm

>18 bnielsen: It's not a fixed number of set tags. But yes, I'll probably use Excel to help me identify any book that for example that doesn't have tag owned or not owned, then any owned book to see if it is missing a location of my library shelves, then any book that has a fiction tag but doesn't have a corresponding fiction type tag, etc. etc. (I have tag prefixes for all those sets which is related to my alphabetized lamentation.)

I much appreciate your ideas! Are busy this afternoon, wanna help? ha ha

20norabelle414
Dec 15, 2025, 3:07 pm

>13 DebiCates: I'm very lucky that tags could be automatically alphabetized for the first several years I was here. Now I only have to alphabetize new books as I add them

21LeslieWx
Dec 15, 2025, 4:00 pm

Here's a thought from someone has never exported from LT and who has used Macs for 40 years (so possibly not as helpful if you're a Windows person). It relies on a very powerful text (flat ascii) editor, BBEdit, made by Bare Bones Software. It also leaves a bit more trail of work than some might leave, because I know I often goof up somewhere & don't want to have to start again from scratch. (IMO, there's no point being this old if you haven't learned some things about yourself!)

If I were facing this problem, I would do this:
1) Find some format I could set up & sort on YourBooks/List that would (a) include at least Author, Title, and Tags AND (b) could be matched line-by-line with an exported Excel file which included at least those same fields. (Sorting might be required for the Excel file to make the order of entries match the YourBooks/List.)

In other words, I want to help my eye-brain processing by having an LT YourBooks listing in a browser window and a listing of the same books in the same order in an Excel window. Maybe sorting by EntryDate works; maybe the addition of some other quantity works. Worst case, I might copy/paste directly from the YourBooks listing and clean things up in a mix of BBEdit & Excel. (I've done such things before.) But I only have 940 books = 19 pages of YourBooks, you'd have double that. If you don't have tags on all books, you could sort by Tags to pare it down.

I say "at least Author, Title, and Tags" because I'm assuming that's enough to uniquely ID each work when looking at either YourBooks/List or the exported Excel file. Maybe you'd also need an "Entry Date" or "Collection" or some other column.

2) Copy the Tags column from the Excel worksheet ("OriginalSheet") into new BBEdit document, and mass-replace the ", " between tags with a tab character. (BBEdit documentation is quite good, you'd be able to figure out how. BBEdit's powerful enough that it can also replace " , " and/or plain "," if needed. Someone else around here must know what LT does with spaces in the Tags field.)

3) Copy/paste the newly delimited contents of the BBEdit document into a new Excel worksheet ("TransferSheet"). Add a column at the beginning of both OriginalSheet & TransferSheet to keep track of their original order ("OldSort"), and maybe bold it for clarity.

4) Copy all those columns and paste them into a new "WorkingSheet" using Paste/Transpose. Now, "OldSort" runs along the top instead of down the side.

5) The Most Tedious Step of All -- Select each column in turn and sort its contents alphabetically, making sure "My Data Has Headers" is checked. (If you've got a package like MATLAB handy that can read in that set of columns, or a FORTRAN or C compiler and know how to use it, you might be happier writing a little script to do this. Might take longer to get it working right, but it would be less tedious!)

6) Copy all those columns and paste them into a new "ResortedSheet" using Paste/Transpose. "OldSort" should run along the left side again.

7) Copy all the columns EXCEPT OldSort in "ResortedSheet" and paste them into another new BBEdit document, then mass replace the tab characters with ", ".

8) Add 2 new columns to "ResortedSheet", just to the right of the OldSort column. Paste the contents of that new BBEdit document into the column next to OldSort. Now you should have, for each work, the following: ColA = OldSort; ColB = comma-delimited tags in alphabetical order; ColC = blank; as many columns as are needed to hold all the sorted tags in alphabetical order. You can spot check that the contents of ColB really hold everything in ColD+ if you're the paranoid/mistake-prone type.

9) OldSort (ColA) in ResortedSheet should be identical to OldSort in OriginalSheet. Maybe check. Then combine at least Author & Title from OriginalSheet with the comma-delimited tags from ResortedSheet ... somewhere. (New sheet? one of the existing sheets? whatever makes you happy.)

10) The Second-Most Tedious Step -- Go through "ResortedSheet" line by line, copying the cell in ColB, clicking on the "work page" icon in that right-hand column in YourBooks/List, hitting the "Tag" button, replacing what's there with the re-ordered tag list & saving, and then going back to YourBooks. (Personally, I'd then go shade that row in the Excel sheet so I knew I'd done it.)

=====
I do see some spots where I could have written more words & made bits of this more efficient, but I really DO need to go get some things done. Anyway, some people do better with a long & very rote process, while others do better with a short process that requires more thinking. Guess which bin I'm in? 😁

22DebiCates
Edited: Dec 15, 2025, 4:28 pm

>21 LeslieWx: I love the brilliance of the idea of keeping the OLDSORT! That would certainly make the cut & paste of tags go quicker.

I realize the only reason I want them alphabetized at this point is to identify books that need work (add missing tags that I like to have on every book). This method could make that go quicker as well. I wouldn't have to stop at every book. Just scroll to the ones that I have previously identified outside of LT (like in Excel), stop at those, cut & paste.

I'm on a Windows machine, but this process would still work. Thanks Leslie! You are so kind to have explained that all so well, even being understood across hardware platforms.

My next step, once everything is in good shape, is to keep it in good shape. I need to think about that, but I have an idea using 3 digit prefixes (LT will bring up everything that begins with 3 characters) then by always entering those in LT, I would make my selections and never miss those tags I always want to have.

23norabelle414
Dec 15, 2025, 6:10 pm

>22 DebiCates: to identify books that need work
Another feature that could be helpful for this is that you can sort by number of tags. It's not in the sort drop-down but you can add it as a catalog column and then click on the column header to sort. It won't catch everything, of course, but you can use it to find books that have the fewest tags.

24LeslieWx
Dec 15, 2025, 6:19 pm

>22 DebiCates: Very glad if it helps 😄 Something like 45y of mistakes went into writing that post 🤣

FWIW, I'm using tags of the form "editBook_*" when I need to upload a cover, or check/find metadata, or what have you. And I always make sure they're the first tags, so that my "To Do" lists pop right out when I look at my listing.

And yes, I love camel case ...

25DebiCates
Edited: Dec 15, 2025, 7:28 pm

>23 norabelle414: I just added number of tags to my "E" option and sorted on it. I can see how that will help me identify the lowest hanging fruit. Thank you.

26DebiCates
Dec 15, 2025, 7:28 pm

>24 LeslieWx: I just add tag "fix" the lazy bones that I am and never thought to add it it the beginning. But you have a heck of a lot more books (and experience) than I do that you are cataloguing. So your prefix + the problem would be much more effective for your to do list. And sanity. ha

27jjwilson61
Dec 15, 2025, 11:23 pm

>19 DebiCates: You can do much of that using the search and power edit functions in LT. No, I don't know how, but there should be wiki pages.

28DebiCates
Dec 16, 2025, 10:19 am

>27 jjwilson61: Woohoo I believe you are right! The "not" option with the "wildcard" option will be very helpful to finding if I have one option set but identify if I am missing another refining tag that should be there with it.

https://wiki.librarything.com/index.php/%22Your_books%22_Search

29DebiCates
Edited: Dec 16, 2025, 3:44 pm

THANK YOU TO EVERYONE!

I don't think I'll worry about alphabetizing. My goal was to easily see where I don't have tags that I want to have for each book. But, instead I think working with the power edit was the way to go to find those. Like when something has a nonfiction tag, it should also have an additional nonfiction sub classification tag.

Coming from GR, there were some particulars to fix first. I found it is better to remove the embedded "-" in my tags (spaces are replaced with a dash on GR and I'm still working on removing them completely here). Having the dash seemed to confuse the search (or confuse me) as a "not" function even if search tag was in quotes when using AND or AND NOT. I used the tag listings page to quickly omit those dashes. P.S. Additionally GR doesn't have a NOT function, only AND--that is why I often had headaches finding where I was missing tags.

Bottom line is this search now works!!!
000nonfiction AND NOT "00nf*"
That search identifies for me books that have the major classification of 000nonfiction but are missing at least one of the secondary 00nf classifications I like to have for my own searching.

FYI My weirdo 000 prefix indicates tag options I want there on all my books. I type in 000 and up comes those fundamental settings when adding a book. The 00nf prefix functions with similar ease for me, especially when just browsing my tags list page. Some of my schemes may really be just a hold over from GR, and as time goes on I may make them more LT-like.

30bnielsen
Dec 16, 2025, 4:27 pm

>29 DebiCates: Nice! You are happy so we are happy :-)

31LeslieWx
Edited: Dec 16, 2025, 5:26 pm

>29 DebiCates: Hooray!

A comment for you: If you want to get rid of the '-'s and you also want to avoid possible(*) search troubles related to blank spaces and/or improve readability, two things might help. (1) using '_' instead of spaces, and/or (2) camelCase, which involves removing the spaces but keeping capitals on all but the first word. (Check out the wikipedia article if you want to get into the weeds or religious wars; the definition I just gave is apparently the one non-Excel thing in the universe on which I agree with Microsoft!

The '_' can have the added benefit of sorting before the alphabet, so I put it as the leading character on a particular set of tags I want to be able to scan quickly in the master list.

(*) I have no idea if blanks in tags cause difficulty in searches, I just don't want to find out.

ETA: I don't think your 000 prefix is any weirder than my "_" and "_x_" prefixes. As my dad would have said, "Everyone here is weird except me and thee, and I'm not always sure about me."

32DebiCates
Dec 16, 2025, 5:46 pm

>30 bnielsen: We are all happy.

>31 LeslieWx: I mostly removed spaces and abutted the text. However, on others, for readability, I used spaces. If I run into trouble (I might) I'll check out the camel thing. Thanks you for all your knowledge and help!