It's fairly easy to automate, either via PowerShell or the Graph API. Here's a short example:
Import-CSV blabla.csv | { Add-UnifiedGroupLinks $_.GroupId -LinkType Member -Links $_.UserId }
where the CSV file has a column GroupID to designate the Group/Team, and a column UserId to designate the user(s) you want added. Make sure to use unique-valued attribute, such as the UPN or ObjectID when populating these properties.
Here's also an example where you expand the current membership of a Group/Team to another Team:
Get-UnifiedGroupLinks GroupID -LinkType Member | % { Add-UnifiedGroupLinks TeamName -LinkType Members -Links $_.ExternalDirectoryObjectId }