---
title: "How to add users to groups in bulk"
canonical: "https://support.appfire.com/space/SUPPORT/89150059/How%20to%20add%20users%20to%20groups%20in%20bulk"
format: markdown
---
# Description

If you have large numbers of users that need to be added to groups, the CLI can be used to automate that procedure using the **addUserToGroup** action. In many cases, you might have definition of what users need to be added to what groups in a **CSV** file, the result of a **SQL** query, or just a plain text list in one form or the other. For example, this [Confluence KB article](https://confluence.atlassian.com/jirakb/migrate-local-group-memberships-between-directories-289277867.html) describes a way of producing this type of information from a Confluence or Crowd directory.

The CLI has various built in actions for bulk operations like this that makes it easy to run a single action to import bulk data. Choice the method that works best for you based on the source of your data. See [Reference](https://appfire.atlassian.net/wiki/spaces/JCLI/pages/70782723) for more details on the following actions:

- **run**
- **runFromCsv**
- **runFromSql**

# AddUserToGroup

This base action is pretty simple: it requires a **userId** and **group**. There are some options to consider using as well:

- **autoGroup** - automatically creates a group if the group specified does not exist.
- **preserveCase** - by default and as a best practice, userIds (also referred to as usernames in Confluence) are lowercased. Use this option to preserve the cased if that is your standard.
- **continue** - use this option to ignore cases where the userId is already in the group. This normally should be use for bulk operations.

# Example - RunFromCsv

We will use **runFromCsv** as an example, but similar techniques can be used for the other cases.

##### **example.csv**

```plaintext
"userId", "group"
admin, jira-administrators
admin, jira-developers
admin, jira-users
```


##### **Action**

```plaintext
--action runFromCsv --file example.csv --continue --common "--action addUserToGroup --autoGroup --continue"
```