Adding bulk users from a .csv or Excel file to a Microsoft Teams team with Power Automate
If you came to this article you might have already created a Microsoft Teams team for your department, project, school or university class; and now you are looking for a quick and easy way to bulk add multiple members from your team or institution.
Maybe you have seen my other tutorial on how to add bulk team members to an existing Microsoft Teams using PowerShell. If you are not that techy or aren’t feeling too adventurous around running blue or black consoles with scripts in your computer, no worries you are in the right place!
Today we don’t have an import user feature from a .csv or Excel file directly from the Teams client, but we have some options to solve this challenge.
Power Automate (The quick easy way ready for anyone)
Power Automate is Microsoft workflow automation tool, formerly called Microsoft Flow. Power Automate, its included in any Office 365 commercial or Education licenses (E1, E3, E5, A1, A3, A5, Business Essentials, Business Premium).
Power Automate lets you automate personal or business process flows with hundreds of included connectors in its standard version, there’s also premium connectors that will allow you to interact with external services and other 3rd parties. For our goal today, standard connectors would me more than enough, for this you will need your existing O365 account.
- Navigate to www.office.com and log-in with your O365 credentials.
- In the landing page look for Power Automate under the O365 apps tab
3. Once inside Power Automate we will need to create a new flow, go the create section on the left panel and select Start From Blank, then pick the Instant Flow. This option means the add user to team operation will be manually triggered by you.
4. Name your flow, in this case we will name it “Add Users to Team”. Be sure to click on the first option that will trigger our flow with the option of Manually trigger a flow. Click on create to start designing our flow.
As easy as that you have created your first Power Automate flow, now let’s prepare the Excel file with your teammates, students, peers, or users you want to add in bulk to your team.
Preparing our users, as easy as an Excel table
To make it easier, we will create a simple Excel table with the emails of the users you want to add to the team. For this we will use the Excel Online from O365 to have our file directly saved to our OneDrive in the cloud and available for the flow we just created.
For this go again to your O365 landing page, and search for Excel in the O365 apps tab. If you have never used Excel Online, it’s almost the same version as the Desktop Excel version but fully cloud and available through a browser.
Create a blank new spreadsheet and add your data. You can have as many columns as you want, but you need to have at least 1 with the user email. Once you have your columns and records, be sure to create an Excel table with the rows. For this select all your rows and columns, and then click on Insert on the top ribbon, and Insert Table.
At the end your table should look like this or similar. In my case I’m using 2 columns Name and Email
The file is automatically saved in your OneDrive, if you want to change the name click on the middle bar, next to saved and you can change the name of your file.
Lets design our flow
Now we are ready to add the 2 simple steps needed to add our users. Go back to the flow in Power Automate that you just created. You should see a blank space with an initial step.
- Select the+ New Step, this will show a menu of all the available triggers or connectors in Power Automate. You will need to look for the “Excel Online (Business) * Be sure it says (Business), as there’s another connector for Excel Online for the consumer OneDrive.
2. Under the Excel Online (Business) Actions tab look for the List Rows from a Table action and select it.
3. Now we will need to configure the action:
- The Location of the file that should be OneDrive for Business.
- The Document Location should be OneDrive
- The file should be the file you created, you should see a file picker to select the Excel file we created in the past steps.
- The table should be the table containing your data from the Excel file, if you didn’t rename the table it should be Table1
4. Now we need to iterate through all the rows of the table, for this select the + New Step bellow the action and look in the catalogue for Control, and select the Apply to each action.
5. To configure the apply to each action click on the empty field and a new window will pop-up, this window lets you access dynamic content from other steps in the flow. Look for the List rows present in table, and select the value (List of Items), so we can get all the rows extracted from the table in the past step.
6. We are almost done, we just need the last step now, select + New Step and this time search for the Office 365 Groups actions in the catalogue. Select the Add Member to group action from the catalogue.
7. Once you added the Add Member to group action, click on the Group ID field to configure it. The dropdown will show all the Teams and Office 365 groups you own, be sure to select the correct group.
8. Select the User Principal Name and the dynamic content pop-up will show again, look for the List rows present in a table content and select the Email or the column name in your table that contains the user email.
We are now ready to add run our flow and add our users from the Excel file to the desired team. Be sure to click on Save before moving away. Your flow now should look like something like this:
Running our flow
To execute our flow, we will go back to our flow page, here you will be able to click on Run on the top tabs.
The flow will prompt to start running, click on continue and then click run flow. The flow will start running. If your flow is correct you will see the executions under the Runs section and you should see a green color Succeeded.
You now might want to go to your Teams client and look for the team, under the Manage Team section you should be able to see all your newly added users appear under the member section. If you need to upgrade any of them to a team owner, you can do it directly from there.
If you are in a rush …
If you just want to configure and use the flow, I exported it and made it available in this Github repo. To import it, download the .zip file with the flow from Github, and then just go to your flows and click on import.
As there are 2 connectors included in the flow, when importing you will need to configure them to acces your own data. Be sure to click on the red items during the import process
Then finally click on import and you should see the new flow automatically created in your flows panel.
Be sure to check steps 3, 7 and 8 to configure the Excel connector and the Office 365 Groups connector so it matches your Excel file and the teams in which you want to add users. If you run it without configuring any of those it will run into errors as it will run with the pre-loaded configuration from my export.
The mighty Power Automate
As you just saw, Power Automate provides an easy and user friendly experience that enables business users and IT Pros to automate and create multiple workflows.
If you want to explore more around Power Automate and other possible scenarios or templates, I would recommend that you check the official documentation or any of the free Microsoft Learn online courses.