Bulk Category Creation via CSV

I’ve been looking into bulk category creation.

The best I’ve found is this solution: Administrative Bulk Operations

Though creating those json files for the purpose of bulk creating new custom categories seems quite tedious unless you have some custom builder to create them and assign the ids correctly. Especially if working with any subcategories.

I think it would be a useful feature for Discourse to support bulk category creation via CSV upload, comparable to how tags are uploaded, formatted in a simple way. For example, like below:

Category Subcategory 1 Subcategory 2 Description
my custom parent category This category is a parent category
my custom parent category my custom subcategory This is a lvl 2 subcategory
my custom parent category my custom subcategory my custom sub-subcategory This is a lvl 3 subcategory

Expanding on this to include other custom options/columns could be considered as well.

Here is an example json entry for a category, when exported using this method: Administrative Bulk Operations

  "id": 1,
  "name": "Uncategorized",
  "color": "0088CC",
  "created_at": "2020-07-23T02:27:33.970Z",
  "user_id": -1,
  "slug": "uncategorized",
  "description": "",
  "text_color": "FFFFFF",
  "auto_close_hours": null,
  "position": 0,
  "parent_category_id": null,
  "auto_close_based_on_last_post": false,
  "topic_template": null,
  "all_topics_wiki": false,
  "permissions_params": {}
1 Like

It’s rare to need to create many categories, so the likelihood that whether interface there is well be to cumbersome to be worthwhile is high.

What I would do is write a ruby script to create the categories from the console. You don’t need any ID. I think you can create them with only the name, but you can also load the description, and permissions if you try hard.


When we did this, one of our mods ran a script with an API key to bulk create these en masse. It worked really well, although if I recall the permissions part was a little weird. Otherwise, it was a HUGE timesaver (we had over 700 subcategories to create).