Trello Script: Find All Board Owners

I am a member of a Trello organization that is over its limit of free boards, so we’re trying to clean up some old boards. The rules in Trello say that the board admin(s) are the people who can delete boards, but there’s not a great place in Trello to get a concise list of all the boards in an organization and the details, so I wrote this little script.

First login to Trello and then go to your organization page.

Then open your browser console and paste in this code, and click Enter:

var csv_arr = [['url', 'name', 'slug', 'id', 'admins']];
$('.boards-page-board-section-list-item').each(function() {
  var board_href = $(this).find('a.board-tile').attr('href');
  if(board_href && board_href.indexOf('/b/') === 0) {
    
    var slug = (board_href.split('/b/')[1]).split('/')[0];
    $.get('https://trello.com/1/Boards/' + slug, function(data) {
      
      $.get('https://trello.com/1/boards/' +  data.id + '?actions=addAttachmentToCard%2CaddChecklistToCard%2CaddMemberToBoard%2CaddMemberToCard%2CaddToOrganizationBoard%2CcommentCard%2CconvertToCardFromCheckItem%2CcopyBoard%2CcopyCard%2CcopyCommentCard%2CcreateBoard%2CcreateCard%2CcreateList%2CdeleteAttachmentFromCard%2CdeleteCard%2CdisablePlugin%2CdisablePowerUp%2CemailCard%2CenablePlugin%2CenablePowerUp%2CmakeAdminOfBoard%2CmakeNormalMemberOfBoard%2CmakeObserverOfBoard%2CmoveCardFromBoard%2CmoveCardToBoard%2CmoveListFromBoard%2CmoveListToBoard%2CremoveChecklistFromCard%2CremoveFromOrganizationBoard%2CremoveMemberFromCard%2CunconfirmedBoardInvitation%2CunconfirmedOrganizationInvitation%2CupdateBoard%2CupdateCard%3Aclosed%2CupdateCard%3Adue%2CupdateCard%3AidList%2CupdateCheckItemStateOnCard%2CupdateList%3Aclosed&actions_display=true&actions_limit=50&cards=visible&card_attachments=true&card_fields=badges%2Cclosed%2Cdesc%2CidAttachmentCover%2CidBoard%2CidList%2CidMembers%2Clabels%2Cname%2Cpos%2CshortLink%2Curl&fields=closed%2CcreationMethod%2CdateLastActivity%2CdateLastView%2CdatePluginDisable%2Cid%2CidOrganization%2Cname%2Cprefs%2CshortLink%2CshortUrl%2Curl%2Cdesc%2CdescData%2CidTags%2Cinvitations%2Cinvited%2ClabelNames%2Climits%2Cmemberships%2CpowerUps%2Csubscribed&labels=all&labels_limit=1000&lists=open&members=all&memberships=all&organization=true&organization_memberships=all', function(data2) {
        var adminUsers = data2.memberships.filter((obj) => {
          return obj.memberType === 'admin';
        });
        var admins = adminUsers.map((obj) => {
          var memberId = obj.idMember;
          return data2.members.find((member) => {
            return member.id === memberId;
          });
        });

        var adminNames = admins.map((ad) => {
          return ad.fullName;
        }).join(', ');
        csv_arr.push(['https://trello.com' + board_href, data.name, slug, data.id, '"' + adminNames + '"']);
      });
    });
  }
});

Then after that gets done running, run this:

console.log(csv_arr.map(function(d){
    return d.join();
}).join('\n'));

This will return a CSV string in your console - copy/paste the entire thing into a text editor, save it as a CSV, and then you can now open it in Excel or any other CSV program.

See Also