Is there any way to get a list of current tags ?

I use a lot of tags. In order to keep my set of tags as logical and efficient as possible, I need to occasionally review existing tags, looking for redundant tags or potential gaps that require new tags. To do this, an easy way to get a list of current tags is required. Is there any way to get such a list ?
  • I assume you're aware of the tag selector on the bottom left? If you're in "My Library" that shows all tags, alphabetically (with colored tags on top).

    If that doesn't work, the best I can come up with is exporting to CSV and the splitting the tag column and removing duplicates, which can both be done in Excel or any scripting language -- not sure that still qualifies as simple, though.
  • Thanks for those suggestions. But I have too many tags for just looking in the tag selector box to be viable. If however there was an option to right-click Select All tags (or a subset) in that box, and then Copy to the clipboard, that would work. So I guess that's a feature request.

    Re the second option, I actually didn't realize that tags were included in a library/collection Export to CSV. But I agree with you that processing that output to get a non-redundant list of tags is not simple. ;)
  • One option is to select all the items in the library, export to CSV, and then open the exported file in a spreadsheet program like Excel. Tags are one column of that file, so you can search and sort from there
  • (I do suggest that above, but you still need to de-dupe, so this is some work)
  • If however there was an option to right-click Select All tags (or a subset) in that box, and then Copy to the clipboard, that would work.
    Turns out that the Zutilo add-on can actually do this: select all items in the middle panel (or select those for which you are interested in the tags), then right-click --> Zutilo --> Copy tags to clipboard.
    I haven't tested this on large tag sets, but it works for small sets and automatically de-dedupes (or rather, treats the same tag as a single tag in the first place)
  • Thanks ! Zutilo worked well and quickly, for a collection with ~3000 items and 150+ tags. Pasted from clipboard into Excel for alphabetical sort.
  • Decided to further address this with some javascript, adding a count of how often each tag has been used. Run under Tools\Developer\Run Javascript:

    var rows = await Zotero.DB.queryAsync("SELECT name AS tagname, COUNT(*) AS num FROM tags JOIN itemTags USING (tagID) GROUP BY tagname ORDER BY UPPER(tagname) ASC");
    var lines = [];
    for (let row of rows) {
    lines.push(row.tagname + '\t' + row.num);
    }
    return lines.join('\n');
Sign In or Register to comment.